rebuild this sucker 😤

This commit is contained in:
leaf corcoran 2013-06-30 21:33:41 -07:00
parent 642932c1d5
commit 0848c1ea71
8 changed files with 107 additions and 79 deletions

View File

@ -306,7 +306,8 @@ do
end
end,
declare = function(self, names)
local undeclared = (function()
local undeclared
do
local _accum_0 = { }
local _len_0 = 1
for _index_0 = 1, #names do
@ -342,8 +343,8 @@ do
break
end
end
return _accum_0
end)()
undeclared = _accum_0
end
return undeclared
end,
whitelist_names = function(self, names)

View File

@ -51,9 +51,9 @@ local value_compilers = {
do
local _with_0 = self:line()
_with_0:append_list((function()
local _list_0 = node
local _accum_0 = { }
local _len_0 = 1
local _list_0 = node
for _index_0 = 2, #_list_0 do
local v = _list_0[_index_0]
_accum_0[_len_0] = self:value(v)
@ -128,7 +128,8 @@ local value_compilers = {
local _, args, whitelist, arrow, block = unpack(node)
local default_args = { }
local self_args = { }
local arg_names = (function()
local arg_names
do
local _accum_0 = { }
local _len_0 = 1
for _index_0 = 1, #args do
@ -149,8 +150,8 @@ local value_compilers = {
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
return _accum_0
end)()
arg_names = _accum_0
end
if arrow == "fat" then
insert(arg_names, 1, "self")
end
@ -190,12 +191,16 @@ local value_compilers = {
}
})
end
local self_arg_values = { }
local _len_0 = 1
for _index_0 = 1, #self_args do
local arg = self_args[_index_0]
self_arg_values[_len_0] = arg[2]
_len_0 = _len_0 + 1
local self_arg_values
do
local _accum_0 = { }
local _len_0 = 1
for _index_0 = 1, #self_args do
local arg = self_args[_index_0]
_accum_0[_len_0] = arg[2]
_len_0 = _len_0 + 1
end
self_arg_values = _accum_0
end
if #self_args > 0 then
_with_0:stm({
@ -206,12 +211,15 @@ local value_compilers = {
end
_with_0:stms(block)
if #args > #arg_names then
arg_names = { }
local _len_1 = 1
for _index_0 = 1, #args do
local arg = args[_index_0]
arg_names[_len_1] = arg[1]
_len_1 = _len_1 + 1
do
local _accum_0 = { }
local _len_0 = 1
for _index_0 = 1, #args do
local arg = args[_index_0]
_accum_0[_len_0] = arg[1]
_len_0 = _len_0 + 1
end
arg_names = _accum_0
end
end
_with_0.header = "function(" .. concat(arg_names, ", ") .. ")"

View File

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

View File

@ -47,14 +47,17 @@ truncate_traceback = function(traceback, chunk_func)
end
stop = stop - 1
end
local _list_0 = traceback
traceback = { }
local _len_0 = 1
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]
traceback[_len_0] = t
_len_0 = _len_0 + 1
do
local _accum_0 = { }
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
_len_0 = _len_0 + 1
end
traceback = _accum_0
end
local rep = "function '" .. chunk_func .. "'"
traceback[#traceback] = traceback[#traceback]:gsub(rep, "main chunk")

View File

@ -317,7 +317,7 @@ Statement = Transformer({
declare_glob = function(self, node)
local names = extract_declarations(self)
if node[2] == "^" then
names = (function()
do
local _accum_0 = { }
local _len_0 = 1
for _index_0 = 1, #names do
@ -337,8 +337,8 @@ Statement = Transformer({
break
end
end
return _accum_0
end)()
names = _accum_0
end
end
return {
"declare",
@ -470,7 +470,8 @@ Statement = Transformer({
end,
import = function(self, node)
local _, names, source = unpack(node)
local table_values = (function()
local table_values
do
local _accum_0 = { }
local _len_0 = 1
for _index_0 = 1, #names do
@ -491,8 +492,8 @@ Statement = Transformer({
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
return _accum_0
end)()
table_values = _accum_0
end
local dest = {
"table",
table_values
@ -566,9 +567,9 @@ Statement = Transformer({
wrapped = build.group({
build.declare({
names = (function()
local _list_0 = stm[2]
local _accum_0 = { }
local _len_0 = 1
local _list_0 = stm[2]
for _index_0 = 1, #_list_0 do
local name = _list_0[_index_0]
if type(name) == "string" then
@ -684,7 +685,7 @@ Statement = Transformer({
smart_node(node)
local source = unpack(node.iter)
local destructures = { }
node.names = (function()
do
local _accum_0 = { }
local _len_0 = 1
for i, name in ipairs(node.names) do
@ -699,8 +700,8 @@ Statement = Transformer({
end
_len_0 = _len_0 + 1
end
return _accum_0
end)()
node.names = _accum_0
end
if next(destructures) then
insert(destructures, build.group(node.body))
node.body = destructures
@ -862,7 +863,7 @@ Statement = Transformer({
end
end
local constructor
properties = (function()
do
local _accum_0 = { }
local _len_0 = 1
for _index_0 = 1, #properties do
@ -886,8 +887,8 @@ Statement = Transformer({
break
end
end
return _accum_0
end)()
properties = _accum_0
end
local parent_cls_name = NameProxy("parent")
local base_name = NameProxy("base")
local self_name = NameProxy("self")
@ -1066,13 +1067,17 @@ Statement = Transformer({
end
return self:set("super", function(block, chain)
if chain then
local _list_0 = chain
local slice = { }
local _len_0 = 1
for _index_0 = 3, #_list_0 do
local item = _list_0[_index_0]
slice[_len_0] = item
_len_0 = _len_0 + 1
local slice
do
local _accum_0 = { }
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
_len_0 = _len_0 + 1
end
slice = _accum_0
end
local new_chain = {
"chain",

View File

@ -198,15 +198,15 @@ split_assign = function(scope, assign)
"_"
}
else
name_slice = (function()
do
local _accum_0 = { }
local _len_0 = 1
for i = start, total_names do
_accum_0[_len_0] = names[i]
_len_0 = _len_0 + 1
end
return _accum_0
end)()
name_slice = _accum_0
end
end
local value_slice
if total_values < start then
@ -214,15 +214,15 @@ split_assign = function(scope, assign)
"nil"
}
else
value_slice = (function()
do
local _accum_0 = { }
local _len_0 = 1
for i = start, total_values do
_accum_0[_len_0] = values[i]
_len_0 = _len_0 + 1
end
return _accum_0
end)()
value_slice = _accum_0
end
end
insert(g, {
"assign",

View File

@ -47,7 +47,8 @@ do
return self.name
end,
chain = function(self, ...)
local items = (function(...)
local items
do
local _accum_0 = { }
local _len_0 = 1
local _list_0 = {
@ -65,8 +66,8 @@ do
end
_len_0 = _len_0 + 1
end
return _accum_0
end)(...)
items = _accum_0
end
return build.chain({
base = self,
unpack(items)

View File

@ -104,15 +104,16 @@ dump = function(what)
end
seen[what] = true
depth = depth + 1
local lines = (function()
local lines
do
local _accum_0 = { }
local _len_0 = 1
for k, v in pairs(what) do
_accum_0[_len_0] = (" "):rep(depth * 4) .. "[" .. tostring(k) .. "] = " .. _dump(v, depth)
_len_0 = _len_0 + 1
end
return _accum_0
end)()
lines = _accum_0
end
seen[what] = false
return "{\n" .. concat(lines) .. (" "):rep((depth - 1) * 4) .. "}\n"
else
@ -123,21 +124,26 @@ dump = function(what)
end
local debug_posmap
debug_posmap = function(posmap, moon_code, lua_code)
local tuples = { }
local _len_0 = 1
for k, v in pairs(posmap) do
tuples[_len_0] = {
k,
v
}
_len_0 = _len_0 + 1
local tuples
do
local _accum_0 = { }
local _len_0 = 1
for k, v in pairs(posmap) do
_accum_0[_len_0] = {
k,
v
}
_len_0 = _len_0 + 1
end
tuples = _accum_0
end
table.sort(tuples, function(a, b)
return a[1] < b[1]
end)
local lines = (function()
local lines
do
local _accum_0 = { }
local _len_1 = 1
local _len_0 = 1
for _index_0 = 1, #tuples do
local pair = tuples[_index_0]
local lua_line, pos = unpack(pair)
@ -145,11 +151,11 @@ 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_1] = _value_0
_len_1 = _len_1 + 1
_accum_0[_len_0] = _value_0
_len_0 = _len_0 + 1
end
return _accum_0
end)()
lines = _accum_0
end
return concat(lines, "\n")
end
local setfenv = setfenv or function(fn, env)