temporary comprehension values don't leak

This commit is contained in:
leaf corcoran 2011-07-14 23:25:30 -07:00
parent ba29e159b5
commit 4634b76ad0
3 changed files with 8 additions and 4 deletions

View File

@ -82,6 +82,9 @@ class Block_
has_name: (name) => has_name: (name) =>
@_names[name] @_names[name]
shadow_name: (name) =>
@_names[name] = false
free_name: (prefix, dont_put) => free_name: (prefix, dont_put) =>
prefix = prefix or "moon" prefix = prefix or "moon"
searching = true searching = true

View File

@ -177,6 +177,7 @@ line_compile =
\stm {"assign", {items_tmp}, {iter}} \stm {"assign", {items_tmp}, {iter}}
block = [s for s in *block] block = [s for s in *block]
\shadow_name name for name in *names
insert block, 1, {"assign", names, { insert block, 1, {"assign", names, {
{"chain", items_tmp, {"index", index_tmp}} {"chain", items_tmp, {"index", index_tmp}}
}} }}

View File

@ -152,7 +152,7 @@ local double = (function()
do do
local _item_0 = items local _item_0 = items
for _index_0 = 1, #_item_0 do for _index_0 = 1, #_item_0 do
x = _item_0[_index_0] local x = _item_0[_index_0]
table.insert(_accum_0, x * 2) table.insert(_accum_0, x * 2)
end end
end end
@ -161,7 +161,7 @@ end)()
do do
local _item_0 = double local _item_0 = double
for _index_0 = 1, #_item_0 do for _index_0 = 1, #_item_0 do
x = _item_0[_index_0] local x = _item_0[_index_0]
print(x) print(x)
end end
end end
@ -170,7 +170,7 @@ local cut = (function()
do do
local _item_0 = items local _item_0 = items
for _index_0 = 1, #_item_0 do for _index_0 = 1, #_item_0 do
x = _item_0[_index_0] local x = _item_0[_index_0]
if x > 3 then if x > 3 then
table.insert(_accum_0, x) table.insert(_accum_0, x)
end end
@ -183,7 +183,7 @@ local hello = (function()
do do
local _item_0 = items local _item_0 = items
for _index_0 = 1, #_item_0 do for _index_0 = 1, #_item_0 do
x = _item_0[_index_0] local x = _item_0[_index_0]
do do
local _item_1 = items local _item_1 = items
for _index_1 = 1, #_item_1 do for _index_1 = 1, #_item_1 do