mlox/lox.t/closure/reuse_closure_slot.lox

16 lines
238 B
Lox
Raw Normal View History

2024-08-03 02:44:12 +02:00
{
var f;
{
var a = "a";
fun f_() { print a; }
f = f_;
}
{
// Since a is out of scope, the local slot will be reused by b. Make sure
// that f still closes over a.
var b = "b";
f(); // expect: a
}
}