Allow passing a value when first starting a fiber.

If the function the fiber is created from takes a parameter, the value
passed to the first call() or transfer() gets bound to that parameter.

Also, this now correctly handles fibers with functions that take
parameters. It used to leave the stack in a busted state. Now, it's a
runtime error to create a fiber with a function that takes any more
than one parameter.
This commit is contained in:
Bob Nystrom
2017-10-19 20:45:13 -07:00
parent e043a95e4e
commit 1661f5368f
12 changed files with 182 additions and 86 deletions
+1 -1
View File
@@ -3,5 +3,5 @@ var fiber = Fiber.new {
}
System.print("before") // expect: before
fiber.call() // expect: fiber
fiber.call() // expect: fiber
System.print("after") // expect: after