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) =>
@_names[name]
shadow_name: (name) =>
@_names[name] = false
free_name: (prefix, dont_put) =>
prefix = prefix or "moon"
searching = true

View File

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

View File

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