2013-12-04 07:43:50 -08:00
|
|
|
{
|
|
|
|
|
var f = null
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
var a = "a"
|
2015-09-15 07:46:09 -07:00
|
|
|
f = Fn.new { System.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"
|
2015-02-26 23:08:36 -08:00
|
|
|
f.call() // expect: a
|
2013-12-04 07:43:50 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-14 15:28:18 -08:00
|
|
|
// TODO: Maximum number of closed-over variables (directly and/or indirect).
|