mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-13 15:18:48 +01:00
This fixes the nasty case where "foo(bar)" is context-sensitive, and generally simplifies the compiler a lot since there is a clear distinction between lexical and dynamic scope. Also: - Remove the special handling of capitalized names since all names are lexical now. - Allow methods to close over local variables in enclosing functions. - Allow implicit definition of all lexical names.
19 lines
312 B
Plaintext
19 lines
312 B
Plaintext
var variable = "before"
|
|
System.print(variable) // expect: before
|
|
variable = "after"
|
|
System.print(variable) // expect: after
|
|
|
|
class Foo {
|
|
static method {
|
|
variable = "method"
|
|
}
|
|
}
|
|
|
|
Foo.method
|
|
System.print(variable) // expect: method
|
|
|
|
Fn.new {
|
|
variable = "fn"
|
|
}.call()
|
|
System.print(variable) // expect: fn
|