rlox/interpreter/tests/lox/this/closure.lox

13 lines
210 B
Lox
Raw Permalink Normal View History

2024-09-01 19:15:55 +02:00
class Foo {
getClosure() {
fun closure() {
return this.toString();
}
return closure;
}
toString() { return "Foo"; }
}
var closure = Foo().getClosure();
print closure(); // expect: Foo