forked from Mirror/wren
Start getting module loading working.
Right now, it uses a weird "import_" method on String which should either be replaced or at least hidden behind some syntax. But it does roughly the right thing. Still lots of corner cases to clean up and stuff to fix. In particular: - Need to handle compilation errors in imported modules. - Need to implicitly import all core and IO types into imported module. - Need to handle circular imports. (Just need to give entry module the right name for this to work.)
This commit is contained in:
@ -58,7 +58,18 @@ class Sequence {
|
||||
}
|
||||
}
|
||||
|
||||
class String is Sequence {}
|
||||
class String is Sequence {
|
||||
import_(variable) {
|
||||
var result = loadModule_
|
||||
if (result == false) {
|
||||
Fiber.abort("Could not find module '" + this + "'.")
|
||||
} else if (result != true) {
|
||||
result.call
|
||||
}
|
||||
|
||||
return lookUpVariable_(variable)
|
||||
}
|
||||
}
|
||||
|
||||
class List is Sequence {
|
||||
addAll(other) {
|
||||
|
||||
Reference in New Issue
Block a user