mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 12:32:41 +00:00
13 lines
210 B
Lox
13 lines
210 B
Lox
|
|
class Foo {
|
||
|
|
getClosure() {
|
||
|
|
fun closure() {
|
||
|
|
return this.toString();
|
||
|
|
}
|
||
|
|
return closure;
|
||
|
|
}
|
||
|
|
|
||
|
|
toString() { return "Foo"; }
|
||
|
|
}
|
||
|
|
|
||
|
|
var closure = Foo().getClosure();
|
||
|
|
print closure(); // expect: Foo
|