Files
wren/test/language/closure/close_over_later_variable.wren

14 lines
413 B
Plaintext
Raw Normal View History

2014-04-24 17:52:53 -07:00
// This is a regression test. There was a bug where if an upvalue for an
// earlier local (here "a") was captured *after* a later one ("b"), then Wren
// would crash because it walked to the end of the upvalue list (correct), but
// then didn't handle not finding the variable.
Fn.new {
2014-04-24 17:52:53 -07:00
var a = "a"
var b = "b"
Fn.new {
System.print(b) // expect: b
System.print(a) // expect: a
}.call()
}.call()