forked from Mirror/wren
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.
13 lines
146 B
Plaintext
13 lines
146 B
Plaintext
var F = null
|
|
|
|
class Foo {
|
|
method(param) {
|
|
F = new Fn {
|
|
IO.print(param)
|
|
}
|
|
}
|
|
}
|
|
|
|
(new Foo).method("param")
|
|
F.call // expect: param
|