Compile imports to closures, not fibers.
This is simpler and marginally faster. We don't need the overhead of fibers since you can't have long or recursive import chains anyway. More importantly, this makes the behavior more well-defined when you do things like yield from an imported module. (Not that you should do that, but if you do, it shouldn't do weird things.)
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
var fiber = Fiber.new {
|
||||
System.print("fiber 1")
|
||||
|
||||
import "yield_from_import_module"
|
||||
|
||||
System.print("fiber 2")
|
||||
}
|
||||
|
||||
fiber.call() // expect: fiber 1
|
||||
// expect: module 1
|
||||
System.print("main 1") // expect: main 1
|
||||
fiber.call() // expect: module 2
|
||||
// expect: fiber 2
|
||||
System.print("main 2") // expect: main 2
|
||||
@@ -0,0 +1,4 @@
|
||||
// nontest
|
||||
System.print("module 1")
|
||||
Fiber.yield()
|
||||
System.print("module 2")
|
||||
Reference in New Issue
Block a user