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