Files
wren/test/closure/reuse_closure_slot.wren
T

18 lines
348 B
Plaintext
Raw Normal View History

2013-12-04 07:43:50 -08:00
{
var f = null
{
var a = "a"
f = fn IO.write(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.