1
0
forked from Mirror/wren

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:
Bob Nystrom
2018-03-17 09:33:33 -07:00
parent 43cf652003
commit 2c88e19497
7 changed files with 105 additions and 104 deletions

View File

@ -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

View File

@ -0,0 +1,4 @@
// nontest
System.print("module 1")
Fiber.yield()
System.print("module 2")