Add support for "nonlocal" (capitalized) names, and change how variable lookup works.
Inside a method, all local variable lookup stops at the method boundary. In other words, methods, do not close over outer local variables. If a name is not found inside a method and is lowercase, it's a method on this. If it's capitalized, it's a global variable.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
var Global = "global"
|
||||
// TODO: Forward reference to global declared after use.
|
||||
|
||||
new Fn {
|
||||
IO.print(Global) // expect: global
|
||||
}.call
|
||||
Reference in New Issue
Block a user