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

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.
2015-07-10 09:18:22 -07:00
Fn.new {
2014-04-24 17:52:53 -07:00
var a = "a"
var b = "b"
2015-07-10 09:18:22 -07:00
Fn.new {
2015-09-15 07:46:09 -07:00
System.print(b) // expect: b
System.print(a) // expect: a
2015-02-26 23:08:36 -08:00
}.call()
}.call()