mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
temporary comprehension values don't leak
This commit is contained in:
parent
ba29e159b5
commit
4634b76ad0
@ -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
|
||||
|
@ -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}}
|
||||
}}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user