This commit is contained in:
leaf corcoran 2013-06-10 19:58:18 -07:00
parent f8c2e0b3ab
commit 39c280138a
5 changed files with 50 additions and 68 deletions

View File

@ -185,16 +185,13 @@ local value_compilers = {
}
})
end
local self_arg_values = (function()
local _accum_0 = { }
local self_arg_values = { }
local _len_0 = 1
for _index_0 = 1, #self_args do
local arg = self_args[_index_0]
_accum_0[_len_0] = arg[2]
self_arg_values[_len_0] = arg[2]
_len_0 = _len_0 + 1
end
return _accum_0
end)()
if #self_args > 0 then
_with_0:stm({
"assign",
@ -204,16 +201,13 @@ local value_compilers = {
end
_with_0:stms(block)
if #args > #arg_names then
arg_names = (function()
local _accum_0 = { }
local _len_0 = 1
arg_names = { }
local _len_1 = 1
for _index_0 = 1, #args do
local arg = args[_index_0]
_accum_0[_len_0] = arg[1]
_len_0 = _len_0 + 1
arg_names[_len_1] = arg[1]
_len_1 = _len_1 + 1
end
return _accum_0
end)()
end
_with_0.header = "function(" .. concat(arg_names, ", ") .. ")"
return _with_0

View File

@ -9,16 +9,13 @@ flat_value = function(op, depth)
if type(op) ~= "table" then
return tostring(op)
end
local items = (function()
local _accum_0 = { }
local items = { }
local _len_0 = 1
for _index_0 = 1, #op do
local item = op[_index_0]
_accum_0[_len_0] = flat_value(item, depth + 1)
items[_len_0] = flat_value(item, depth + 1)
_len_0 = _len_0 + 1
end
return _accum_0
end)()
local pos = op[-1]
return "{" .. (pos and "[" .. pos .. "] " or "") .. table.concat(items, ", ") .. "}"
end

View File

@ -42,18 +42,15 @@ truncate_traceback = function(traceback, chunk_func)
end
stop = stop - 1
end
traceback = (function()
local _accum_0 = { }
traceback = { }
local _len_0 = 1
local _list_0 = traceback
local _max_0 = stop
for _index_0 = 1, _max_0 < 0 and #_list_0 + _max_0 or _max_0 do
local t = _list_0[_index_0]
_accum_0[_len_0] = t
traceback[_len_0] = t
_len_0 = _len_0 + 1
end
return _accum_0
end)()
local rep = "function '" .. chunk_func .. "'"
traceback[#traceback] = traceback[#traceback]:gsub(rep, "main chunk")
return concat(traceback, "\n")

View File

@ -1109,17 +1109,14 @@ Statement = Transformer({
end
return self:set("super", function(block, chain)
if chain then
local slice = (function()
local _accum_0 = { }
local slice = { }
local _len_0 = 1
local _list_0 = chain
for _index_0 = 3, #_list_0 do
local item = _list_0[_index_0]
_accum_0[_len_0] = item
slice[_len_0] = item
_len_0 = _len_0 + 1
end
return _accum_0
end)()
local new_chain = {
"chain",
parent_cls_name

View File

@ -119,24 +119,21 @@ dump = function(what)
end
local debug_posmap
debug_posmap = function(posmap, moon_code, lua_code)
local tuples = (function()
local _accum_0 = { }
local tuples = { }
local _len_0 = 1
for k, v in pairs(posmap) do
_accum_0[_len_0] = {
tuples[_len_0] = {
k,
v
}
_len_0 = _len_0 + 1
end
return _accum_0
end)()
table.sort(tuples, function(a, b)
return a[1] < b[1]
end)
local lines = (function()
local _accum_0 = { }
local _len_0 = 1
local _len_1 = 1
for _index_0 = 1, #tuples do
local pair = tuples[_index_0]
local lua_line, pos = unpack(pair)
@ -144,8 +141,8 @@ debug_posmap = function(posmap, moon_code, lua_code)
local lua_text = get_line(lua_code, lua_line)
local moon_text = get_closest_line(moon_code, moon_line)
local _value_0 = tostring(pos) .. "\t " .. tostring(lua_line) .. ":[ " .. tostring(trim(lua_text)) .. " ] >> " .. tostring(moon_line) .. ":[ " .. tostring(trim(moon_text)) .. " ]"
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
_accum_0[_len_1] = _value_0
_len_1 = _len_1 + 1
end
return _accum_0
end)()