rlox/interpreter/tests/lox/this/closure.lox
2024-09-01 19:15:55 +02:00

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