update accumulator after expression

This commit is contained in:
leaf corcoran 2013-01-12 13:01:34 -08:00
parent d4ed7c91ea
commit 7cd0fcc632
7 changed files with 67 additions and 67 deletions

View File

@ -1238,7 +1238,7 @@ do
wrap = function(self, node)
return build.block_exp({
build.assign_one(self.accum_name, build.table()),
build.assign_one(self.len_name, 0),
build.assign_one(self.len_name, 1),
node,
self.accum_name
})
@ -1273,13 +1273,13 @@ do
val = self.value_name
end
local update = {
build.assign_one(self.accum_name:index(self.len_name), val),
{
"update",
self.len_name,
"+=",
1
},
build.assign_one(self.accum_name:index(self.len_name), val)
}
}
if skip_nil then
table.insert(body, build["if"]({

View File

@ -691,7 +691,7 @@ class Accumulator
wrap: (node) =>
build.block_exp {
build.assign_one @accum_name, build.table!
build.assign_one @len_name, 0
build.assign_one @len_name, 1
node
@accum_name
}
@ -715,8 +715,8 @@ class Accumulator
@value_name
update = {
{"update", @len_name, "+=", 1}
build.assign_one @accum_name\index(@len_name), val
{"update", @len_name, "+=", 1}
}
if skip_nil

View File

@ -8,38 +8,38 @@ local dont_bubble
dont_bubble = function()
return (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for x in (function(...)
return print(...)
end)("hello") do
_len_0 = _len_0 + 1
_accum_0[_len_0] = x
_len_0 = _len_0 + 1
end
return _accum_0
end)()
end
local k = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for x in (function(...)
return print(...)
end)("hello") do
_len_0 = _len_0 + 1
_accum_0[_len_0] = x
_len_0 = _len_0 + 1
end
return _accum_0
end)()
local j = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for i = 1, 10 do
local _value_0
_value_0 = function(...)
return print(...)
end
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
end
return _accum_0
@ -48,15 +48,15 @@ local m
m = function(...)
return (function(...)
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
local _list_0 = {
...
}
for _index_0 = 1, #_list_0 do
local x = _list_0[_index_0]
if f(...) > 4 then
_len_0 = _len_0 + 1
_accum_0[_len_0] = x
_len_0 = _len_0 + 1
end
end
return _accum_0
@ -64,7 +64,7 @@ m = function(...)
end
local x = (function(...)
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
local _list_0 = {
...
}
@ -72,59 +72,59 @@ local x = (function(...)
local i = _list_0[_index_0]
local _value_0 = i
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
end
return _accum_0
end)(...)
local y = (function(...)
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
local _list_0 = {
...
}
for _index_0 = 1, #_list_0 do
x = _list_0[_index_0]
_len_0 = _len_0 + 1
_accum_0[_len_0] = x
_len_0 = _len_0 + 1
end
return _accum_0
end)(...)
local z = (function(...)
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for x in hallo do
if f(...) > 4 then
_len_0 = _len_0 + 1
_accum_0[_len_0] = x
_len_0 = _len_0 + 1
end
end
return _accum_0
end)(...)
local a = (function(...)
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for i = 1, 10 do
local _value_0 = ...
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
end
return _accum_0
end)(...)
local b = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for i = 1, 10 do
local _value_0
_value_0 = function()
return print(...)
end
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
end
return _accum_0

View File

@ -68,10 +68,10 @@ return (function()
x = _list_0[_index_0]
local _key_0, _val_0 = unpack((function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for i, a in ipairs(x) do
_len_0 = _len_0 + 1
_accum_0[_len_0] = a * i
_len_0 = _len_0 + 1
end
return _accum_0
end)())

View File

@ -1,14 +1,14 @@
local hi = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for _, x in ipairs({
1,
2,
3,
4
}) do
_len_0 = _len_0 + 1
_accum_0[_len_0] = x * 2
_len_0 = _len_0 + 1
end
return _accum_0
end)()
@ -22,10 +22,10 @@ local items = {
}
local mm = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for self.x in ipairs(items) do
_len_0 = _len_0 + 1
_accum_0[_len_0] = self.x
_len_0 = _len_0 + 1
end
return _accum_0
end)()
@ -36,7 +36,7 @@ for z in ipairs(items) do
end
local rad = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for a in ipairs({
1,
2,
@ -46,10 +46,10 @@ local rad = (function()
6
}) do
if good_number(a) then
_len_0 = _len_0 + 1
_accum_0[_len_0] = {
a
}
_len_0 = _len_0 + 1
end
end
return _accum_0
@ -78,24 +78,24 @@ range = function(count)
end
dump((function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for x in range(10) do
_len_0 = _len_0 + 1
_accum_0[_len_0] = x
_len_0 = _len_0 + 1
end
return _accum_0
end)())
dump((function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for x in range(5) do
if x > 2 then
for y in range(5) do
_len_0 = _len_0 + 1
_accum_0[_len_0] = {
x,
y
}
_len_0 = _len_0 + 1
end
end
end
@ -103,13 +103,13 @@ dump((function()
end)())
local things = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for x in range(10) do
if x > 5 then
for y in range(10) do
if y > 7 then
_len_0 = _len_0 + 1
_accum_0[_len_0] = x + y
_len_0 = _len_0 + 1
end
end
end
@ -139,10 +139,10 @@ for x in x do
end
local x = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for x in x do
_len_0 = _len_0 + 1
_accum_0[_len_0] = x
_len_0 = _len_0 + 1
end
return _accum_0
end)()
@ -163,12 +163,12 @@ for x in ipairs({
end
local double = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
local _list_0 = items
for _index_0 = 1, #_list_0 do
x = _list_0[_index_0]
_len_0 = _len_0 + 1
_accum_0[_len_0] = x * 2
_len_0 = _len_0 + 1
end
return _accum_0
end)()
@ -179,28 +179,28 @@ for _index_0 = 1, #_list_0 do
end
local cut = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
local _list_1 = items
for _index_0 = 1, #_list_1 do
x = _list_1[_index_0]
if x > 3 then
_len_0 = _len_0 + 1
_accum_0[_len_0] = x
_len_0 = _len_0 + 1
end
end
return _accum_0
end)()
local hello = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
local _list_1 = items
for _index_0 = 1, #_list_1 do
x = _list_1[_index_0]
local _list_2 = items
for _index_1 = 1, #_list_2 do
local y = _list_2[_index_1]
_len_0 = _len_0 + 1
_accum_0[_len_0] = x + y
_len_0 = _len_0 + 1
end
end
return _accum_0
@ -257,10 +257,10 @@ local normal
normal = function(hello)
return (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for x in yeah do
_len_0 = _len_0 + 1
_accum_0[_len_0] = x
_len_0 = _len_0 + 1
end
return _accum_0
end)()
@ -289,12 +289,12 @@ end
return function()
return (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
local _list_9 = things
for _index_0 = 1, #_list_9 do
x = _list_9[_index_0]
_len_0 = _len_0 + 1
_accum_0[_len_0] = x
_len_0 = _len_0 + 1
end
return _accum_0
end)()

View File

@ -50,7 +50,7 @@ local hello = {
}
x = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
local _list_1 = hello
for _index_0 = 1, #_list_1 do
local y = _list_1[_index_0]
@ -59,8 +59,8 @@ x = (function()
_value_0 = y
end
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
end
return _accum_0
@ -74,12 +74,12 @@ x = function()
end
local t = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for i = 10, 20 do
local _value_0 = i * 2
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
end
return _accum_0
@ -87,13 +87,13 @@ end)()
local hmm = 0
local y = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for j = 3, 30, 8 do
hmm = hmm + 1
local _value_0 = j * hmm
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
end
return _accum_0
@ -107,12 +107,12 @@ end
_ = function()
return (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for k = 10, 40 do
local _value_0 = "okay"
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
end
return _accum_0
@ -132,41 +132,41 @@ end
local i = 0
x = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
while i < 10 do
local _value_0
i = i + 1
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
end
return _accum_0
end)()
x = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
local _list_1 = 3
for _index_0 = 1, #_list_1 do
local thing = _list_1[_index_0]
local _value_0
y = "hello"
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
end
return _accum_0
end)()
x = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for x = 1, 2 do
local _value_0
y = "hello"
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
end
return _accum_0
@ -205,7 +205,7 @@ for x = 1, 10 do
end
local list = (function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for x = 1, 10 do
local _continue_0 = false
repeat
@ -215,8 +215,8 @@ local list = (function()
end
local _value_0 = x
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
_continue_0 = true
until true

View File

@ -91,10 +91,10 @@ x = -hello(world(one(two)))
local hi = -"herfef"
x = -(function()
local _accum_0 = { }
local _len_0 = 0
local _len_0 = 1
for x in x do
_len_0 = _len_0 + 1
_accum_0[_len_0] = x
_len_0 = _len_0 + 1
end
return _accum_0
end)()