Files
wren/test/closure/close_over_later_variable.wren
Bob Nystrom 96ceaa528b Allow empty argument list methods.
- Compile them as calls and definitions.
- Use them for call(), clear(), run(), try(), and yield().
- Update the docs.
2015-02-26 23:08:36 -08:00

14 lines
405 B
Plaintext

// 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.
new Fn {
var a = "a"
var b = "b"
new Fn {
IO.print(b) // expect: b
IO.print(a) // expect: a
}.call()
}.call()