Files
wren/test/closure/reuse_closure_slot.wren
T

18 lines
356 B
Plaintext
Raw Normal View History

2013-12-04 07:43:50 -08:00
{
var f = null
{
var a = "a"
2014-04-02 19:41:53 -07:00
f = new Fn { IO.print(a) }
2013-12-04 07:43:50 -08:00
}
{
// 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.call // expect: a
}
}
// TODO: Maximum number of closed-over variables (directly and/or indirect).
2013-12-21 15:55:08 -08:00
// TODO: Shadow variable used in closure.