Fix scoping and break statements.
Variables declared in the loop were not properly disposed of when you broke out of the loop.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
var f = fn {
|
||||
while (true) {
|
||||
var i = "i"
|
||||
return fn IO.print(i)
|
||||
}
|
||||
}
|
||||
|
||||
var g = f.call
|
||||
g.call
|
||||
// expect: i
|
||||
@@ -0,0 +1,9 @@
|
||||
var f = fn {
|
||||
while (true) {
|
||||
var i = "i"
|
||||
return i
|
||||
}
|
||||
}
|
||||
|
||||
IO.print(f.call)
|
||||
// expect: i
|
||||
Reference in New Issue
Block a user