This commit is contained in:
leaf corcoran 2013-06-10 19:20:44 -07:00
parent 4978054a8f
commit dc9d5507a1
10 changed files with 79 additions and 114 deletions

View File

@ -125,9 +125,8 @@ mixin = function(self, cls, ...)
return cls.__init(self, ...)
end
mixin_object = function(self, object, methods)
local _list_0 = methods
for _index_0 = 1, #_list_0 do
local name = _list_0[_index_0]
for _index_0 = 1, #methods do
local name = methods[_index_0]
self[name] = function(parent, ...)
return object[name](object, ...)
end
@ -135,9 +134,8 @@ mixin_object = function(self, object, methods)
end
mixin_table = function(self, tbl, keys)
if keys then
local _list_0 = keys
for _index_0 = 1, #_list_0 do
local key = _list_0[_index_0]
for _index_0 = 1, #keys do
local key = keys[_index_0]
self[key] = tbl[key]
end
else

View File

@ -118,9 +118,8 @@ do
return (function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = t
for _index_0 = 1, #_list_0 do
local v = _list_0[_index_0]
for _index_0 = 1, #t do
local v = t[_index_0]
_accum_0[_len_0] = strip(v)
_len_0 = _len_0 + 1
end
@ -174,9 +173,8 @@ do
if not (self.pos) then
self.pos = item.pos
end
local _list_0 = item
for _index_0 = 1, #_list_0 do
local value = _list_0[_index_0]
for _index_0 = 1, #item do
local value = item[_index_0]
self:_append_single(value)
end
else
@ -210,14 +208,13 @@ do
buffer:add(concat(current))
return buffer:mark_pos(self.pos)
end
local _list_0 = self
for _index_0 = 1, #_list_0 do
local chunk = _list_0[_index_0]
for _index_0 = 1, #self do
local chunk = self[_index_0]
local _exp_0 = mtype(chunk)
if Block == _exp_0 then
local _list_1 = chunk:render(Lines())
for _index_1 = 1, #_list_1 do
local block_chunk = _list_1[_index_1]
local _list_0 = chunk:render(Lines())
for _index_1 = 1, #_list_0 do
local block_chunk = _list_0[_index_1]
if "string" == type(block_chunk) then
insert(current, block_chunk)
else
@ -357,11 +354,10 @@ do
local undeclared = (function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = names
for _index_0 = 1, #_list_0 do
for _index_0 = 1, #names do
local _continue_0 = false
repeat
local name = _list_0[_index_0]
local name = names[_index_0]
local is_local = false
local real_name
local _exp_0 = mtype(name)
@ -543,9 +539,8 @@ do
_with_0:append_list((function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = values
for _index_0 = 1, #_list_0 do
local v = _list_0[_index_0]
for _index_0 = 1, #values do
local v = values[_index_0]
_accum_0[_len_0] = self:value(v)
_len_0 = _len_0 + 1
end

View File

@ -27,9 +27,8 @@ local statement_compilers = {
_with_0:append_list((function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = undeclared
for _index_0 = 1, #_list_0 do
local name = _list_0[_index_0]
for _index_0 = 1, #undeclared do
local name = undeclared[_index_0]
_accum_0[_len_0] = self:name(name)
_len_0 = _len_0 + 1
end
@ -47,9 +46,8 @@ local statement_compilers = {
_with_0:append_list((function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = names
for _index_0 = 1, #_list_0 do
local name = _list_0[_index_0]
for _index_0 = 1, #names do
local name = names[_index_0]
_accum_0[_len_0] = self:name(name)
_len_0 = _len_0 + 1
end
@ -81,9 +79,8 @@ local statement_compilers = {
_with_0:append_list((function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = names
for _index_0 = 1, #_list_0 do
local name = _list_0[_index_0]
for _index_0 = 1, #names do
local name = names[_index_0]
_accum_0[_len_0] = self:value(name)
_len_0 = _len_0 + 1
end
@ -94,9 +91,8 @@ local statement_compilers = {
_with_0:append_list((function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = values
for _index_0 = 1, #_list_0 do
local v = _list_0[_index_0]
for _index_0 = 1, #values do
local v = values[_index_0]
_accum_0[_len_0] = self:value(v)
_len_0 = _len_0 + 1
end
@ -190,9 +186,8 @@ local statement_compilers = {
loop:append_list((function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = names
for _index_0 = 1, #_list_0 do
local name = _list_0[_index_0]
for _index_0 = 1, #names do
local name = names[_index_0]
_accum_0[_len_0] = _with_0:name(name, false)
_len_0 = _len_0 + 1
end
@ -202,9 +197,8 @@ local statement_compilers = {
loop:append_list((function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = exps
for _index_0 = 1, #_list_0 do
local exp = _list_0[_index_0]
for _index_0 = 1, #exps do
local exp = exps[_index_0]
_accum_0[_len_0] = self:value(exp)
_len_0 = _len_0 + 1
end

View File

@ -126,9 +126,8 @@ local value_compilers = {
local arg_names = (function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = args
for _index_0 = 1, #_list_0 do
local arg = _list_0[_index_0]
for _index_0 = 1, #args do
local arg = args[_index_0]
local name, default_value = unpack(arg)
if type(name) == "string" then
name = name
@ -155,14 +154,12 @@ local value_compilers = {
if #whitelist > 0 then
_with_0:whitelist_names(whitelist)
end
local _list_0 = arg_names
for _index_0 = 1, #_list_0 do
local name = _list_0[_index_0]
for _index_0 = 1, #arg_names do
local name = arg_names[_index_0]
_with_0:put_name(name)
end
local _list_1 = default_args
for _index_0 = 1, #_list_1 do
local default = _list_1[_index_0]
for _index_0 = 1, #default_args do
local default = default_args[_index_0]
local name, value = unpack(default)
if type(name) == "table" then
name = name[2]
@ -191,9 +188,8 @@ local value_compilers = {
local self_arg_values = (function()
local _accum_0 = { }
local _len_0 = 1
local _list_2 = self_args
for _index_0 = 1, #_list_2 do
local arg = _list_2[_index_0]
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
@ -211,9 +207,8 @@ local value_compilers = {
arg_names = (function()
local _accum_0 = { }
local _len_0 = 1
local _list_2 = args
for _index_0 = 1, #_list_2 do
local arg = _list_2[_index_0]
for _index_0 = 1, #args do
local arg = args[_index_0]
_accum_0[_len_0] = arg[1]
_len_0 = _len_0 + 1
end

View File

@ -2,9 +2,8 @@ local concat, remove, insert = table.concat, table.remove, table.insert
local Set
Set = function(items)
local self = { }
local _list_0 = items
for _index_0 = 1, #_list_0 do
local key = _list_0[_index_0]
for _index_0 = 1, #items do
local key = items[_index_0]
self[key] = true
end
return self

View File

@ -12,9 +12,8 @@ flat_value = function(op, depth)
local items = (function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = op
for _index_0 = 1, #_list_0 do
local item = _list_0[_index_0]
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

View File

@ -352,11 +352,10 @@ local Statement = Transformer({
names = (function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = names
for _index_0 = 1, #_list_0 do
for _index_0 = 1, #names do
local _continue_0 = false
repeat
local name = _list_0[_index_0]
local name = names[_index_0]
if not (name:match("^%u")) then
_continue_0 = true
break
@ -480,9 +479,8 @@ local Statement = Transformer({
local stubs = (function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = names
for _index_0 = 1, #_list_0 do
local name = _list_0[_index_0]
for _index_0 = 1, #names do
local name = names[_index_0]
if type(name) == "table" then
_accum_0[_len_0] = name
else
@ -498,9 +496,8 @@ local Statement = Transformer({
local real_names = (function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = names
for _index_0 = 1, #_list_0 do
local name = _list_0[_index_0]
for _index_0 = 1, #names do
local name = names[_index_0]
_accum_0[_len_0] = type(name) == "table" and name[2] or name
_len_0 = _len_0 + 1
end
@ -512,9 +509,8 @@ local Statement = Transformer({
values = (function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = stubs
for _index_0 = 1, #_list_0 do
local stub = _list_0[_index_0]
for _index_0 = 1, #stubs do
local stub = stubs[_index_0]
_accum_0[_len_0] = build.chain({
base = source,
stub
@ -538,9 +534,8 @@ local Statement = Transformer({
values = (function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = stubs
for _index_0 = 1, #_list_0 do
local stub = _list_0[_index_0]
for _index_0 = 1, #stubs do
local stub = stubs[_index_0]
_accum_0[_len_0] = build.chain({
base = source_name,
stub
@ -867,9 +862,8 @@ local Statement = Transformer({
local if_stm = {
"if"
}
local _list_0 = conds
for _index_0 = 1, #_list_0 do
local cond = _list_0[_index_0]
for _index_0 = 1, #conds do
local cond = conds[_index_0]
local if_cond = convert_cond(cond)
if first then
first = false
@ -888,16 +882,15 @@ local Statement = Transformer({
local _, name, parent_val, body = unpack(node)
local statements = { }
local properties = { }
local _list_0 = body
for _index_0 = 1, #_list_0 do
local item = _list_0[_index_0]
for _index_0 = 1, #body do
local item = body[_index_0]
local _exp_0 = item[1]
if "stm" == _exp_0 then
insert(statements, item[2])
elseif "props" == _exp_0 then
local _list_1 = item
for _index_1 = 2, #_list_1 do
local tuple = _list_1[_index_1]
local _list_0 = item
for _index_1 = 2, #_list_0 do
local tuple = _list_0[_index_1]
if ntype(tuple[1]) == "self" then
insert(statements, build.assign_one(unpack(tuple)))
else
@ -910,11 +903,10 @@ local Statement = Transformer({
properties = (function()
local _accum_0 = { }
local _len_0 = 1
local _list_1 = properties
for _index_0 = 1, #_list_1 do
for _index_0 = 1, #properties do
local _continue_0 = false
repeat
local tuple = _list_1[_index_0]
local tuple = properties[_index_0]
local key = tuple[1]
local _value_0
if key[1] == "key_literal" and key[2] == constructor_name then
@ -1112,9 +1104,9 @@ local Statement = Transformer({
local slice = (function()
local _accum_0 = { }
local _len_0 = 1
local _list_1 = chain
for _index_0 = 3, #_list_1 do
local item = _list_1[_index_0]
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
@ -1163,9 +1155,8 @@ local Statement = Transformer({
}
}
end
local _list_1 = slice
for _index_0 = 1, #_list_1 do
local item = _list_1[_index_0]
for _index_0 = 1, #slice do
local item = slice[_index_0]
insert(new_chain, item)
end
return new_chain

View File

@ -29,9 +29,8 @@ join = function(...)
}
for _index_0 = 1, #_list_0 do
local tbl = _list_0[_index_0]
local _list_1 = tbl
for _index_1 = 1, #_list_1 do
local v = _list_1[_index_1]
for _index_1 = 1, #tbl do
local v = tbl[_index_1]
out[i] = v
i = i + 1
end
@ -41,9 +40,8 @@ join = function(...)
end
local has_destructure
has_destructure = function(names)
local _list_0 = names
for _index_0 = 1, #_list_0 do
local n = _list_0[_index_0]
for _index_0 = 1, #names do
local n = names[_index_0]
if ntype(n) == "table" then
return true
end
@ -133,9 +131,8 @@ build_assign = function(scope, destruct_literal, receiver)
obj = obj
end
end
local _list_0 = extracted_names
for _index_0 = 1, #_list_0 do
local tuple = _list_0[_index_0]
for _index_0 = 1, #extracted_names do
local tuple = extracted_names[_index_0]
insert(names, tuple[1])
insert(values, NameProxy.chain(obj, unpack(tuple[2])))
end

View File

@ -232,9 +232,8 @@ build = setmetatable({
if tbl == nil then
tbl = { }
end
local _list_0 = tbl
for _index_0 = 1, #_list_0 do
local tuple = _list_0[_index_0]
for _index_0 = 1, #tbl do
local tuple = tbl[_index_0]
if type(tuple[1]) == "string" then
tuple[1] = {
"key_literal",
@ -259,9 +258,8 @@ build = setmetatable({
"chain",
base
}
local _list_0 = parts
for _index_0 = 1, #_list_0 do
local part = _list_0[_index_0]
for _index_0 = 1, #parts do
local part = parts[_index_0]
insert(node, part)
end
return node

View File

@ -137,9 +137,8 @@ debug_posmap = function(posmap, moon_code, lua_code)
local lines = (function()
local _accum_0 = { }
local _len_0 = 1
local _list_0 = tuples
for _index_0 = 1, #_list_0 do
local pair = _list_0[_index_0]
for _index_0 = 1, #tuples do
local pair = tuples[_index_0]
local lua_line, pos = unpack(pair)
local moon_line = pos_to_line(moon_code, pos)
local lua_text = get_line(lua_code, lua_line)