diff --git a/Makefile b/Makefile index 12e552a..967700f 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ -compile: - moonc moon/ moonscript/ - local: luarocks make --local moonscript-dev-1.rockspec global: - sudo luarocks make moonscript-dev-1.rockspec \ No newline at end of file + sudo luarocks make moonscript-dev-1.rockspec + +compile: + bin/moonc moon/ moonscript/ diff --git a/moonscript/compile.lua b/moonscript/compile.lua index fc2c541..073aecd 100644 --- a/moonscript/compile.lua +++ b/moonscript/compile.lua @@ -19,16 +19,15 @@ end local concat, insert = table.concat, table.insert local pos_to_line, get_closest_line, trim = util.pos_to_line, util.get_closest_line, util.trim local Line -Line = (function(_parent_0) +Line = (function() + local _parent_0 = nil local _base_0 = { _append_single = function(self, item) if util.moon.type(item) == Line then - do - local _item_0 = item - for _index_0 = 1, #_item_0 do - local value = _item_0[_index_0] - self:_append_single(value) - end + local _list_0 = item + for _index_0 = 1, #_list_0 do + value = _list_0[_index_0] + self:_append_single(value) end else insert(self, item) @@ -44,14 +43,12 @@ Line = (function(_parent_0) end end, append = function(self, ...) - do - local _item_0 = { - ... - } - for _index_0 = 1, #_item_0 do - local item = _item_0[_index_0] - self:_append_single(item) - end + local _list_0 = { + ... + } + for _index_0 = 1, #_list_0 do + local item = _list_0[_index_0] + self:_append_single(item) end return nil end, @@ -83,17 +80,18 @@ Line = (function(_parent_0) end }, { __index = _base_0, - __call = function(mt, ...) - local self = setmetatable({}, _base_0) - mt.__init(self, ...) - return self + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 end }) _base_0.__class = _class_0 return _class_0 end)() local Block_ -Block_ = (function(_parent_0) +Block_ = (function() + local _parent_0 = nil local _base_0 = { header = "do", footer = "end", @@ -119,35 +117,31 @@ Block_ = (function(_parent_0) local undeclared = (function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = names - for _index_0 = 1, #_item_0 do - local name = _item_0[_index_0] - local t = util.moon.type(name) - local real_name - if t == NameProxy then - real_name = name:get_name(self) - elseif t == "string" then - real_name = name - end - local _value_0 - if real_name and not self:has_name(real_name) then - _value_0 = real_name - end - if _value_0 ~= nil then - _len_0 = _len_0 + 1 - _accum_0[_len_0] = _value_0 - end + local _list_0 = names + for _index_0 = 1, #_list_0 do + local name = _list_0[_index_0] + local t = util.moon.type(name) + local real_name + if t == NameProxy then + real_name = name:get_name(self) + elseif t == "string" then + real_name = name + end + local _value_0 + if real_name and not self:has_name(real_name) then + _value_0 = real_name + end + if _value_0 ~= nil then + _len_0 = _len_0 + 1 + _accum_0[_len_0] = _value_0 end end return _accum_0 end)() - do - local _item_0 = undeclared - for _index_0 = 1, #_item_0 do - local name = _item_0[_index_0] - self:put_name(name) - end + local _list_0 = undeclared + for _index_0 = 1, #_list_0 do + local name = _list_0[_index_0] + self:put_name(name) end return undeclared end, @@ -230,20 +224,18 @@ Block_ = (function(_parent_0) end end, add_line_tables = function(self, line) - do - local _item_0 = line - for _index_0 = 1, #_item_0 do - local chunk = _item_0[_index_0] - if util.moon.type(chunk) == Block then - local current = chunk - while current do - if util.moon.type(current.header) == Line then - self:add_line_tables(current.header) - end - self:append_line_table(current:line_table(), 0) - self.current_line = self.current_line + current.current_line - current = current.next + local _list_0 = line + for _index_0 = 1, #_list_0 do + local chunk = _list_0[_index_0] + if util.moon.type(chunk) == Block then + local current = chunk + while current do + if util.moon.type(current.header) == Line then + self:add_line_tables(current.header) end + self:append_line_table(current:line_table(), 0) + self.current_line = self.current_line + current.current_line + current = current.next end end end @@ -347,13 +339,11 @@ Block_ = (function(_parent_0) _with_0:append_list((function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = values - for _index_0 = 1, #_item_0 do - local v = _item_0[_index_0] - _len_0 = _len_0 + 1 - _accum_0[_len_0] = self:value(v) - end + local _list_0 = values + for _index_0 = 1, #_list_0 do + local v = _list_0[_index_0] + _len_0 = _len_0 + 1 + _accum_0[_len_0] = self:value(v) end return _accum_0 end)(), delim) @@ -425,12 +415,10 @@ Block_ = (function(_parent_0) if ret then self:ret_stms(stms, ret) else - do - local _item_0 = stms - for _index_0 = 1, #_item_0 do - local stm = _item_0[_index_0] - self:stm(stm) - end + local _list_0 = stms + for _index_0 = 1, #_list_0 do + local stm = _list_0[_index_0] + self:stm(stm) end end return nil @@ -459,17 +447,18 @@ Block_ = (function(_parent_0) end }, { __index = _base_0, - __call = function(mt, ...) - local self = setmetatable({}, _base_0) - mt.__init(self, ...) - return self + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 end }) _base_0.__class = _class_0 return _class_0 end)() local RootBlock -RootBlock = (function(_parent_0) +RootBlock = (function() + local _parent_0 = Block_ local _base_0 = { render = function(self) self:_insert_breaks() @@ -488,15 +477,15 @@ RootBlock = (function(_parent_0) end }, { __index = _base_0, - __call = function(mt, ...) - local self = setmetatable({}, _base_0) - mt.__init(self, ...) - return self + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 end }) _base_0.__class = _class_0 return _class_0 -end)(Block_) +end)() Block = Block_ format_error = function(msg, pos, file_str) local line = pos_to_line(file_str, pos) @@ -520,12 +509,10 @@ end tree = function(tree) local scope = RootBlock() local runner = coroutine.create(function() - do - local _item_0 = tree - for _index_0 = 1, #_item_0 do - local line = _item_0[_index_0] - scope:stm(line) - end + local _list_0 = tree + for _index_0 = 1, #_list_0 do + local line = _list_0[_index_0] + scope:stm(line) end return scope:render() end) diff --git a/moonscript/compile/format.lua b/moonscript/compile/format.lua index 557a950..100e741 100644 --- a/moonscript/compile/format.lua +++ b/moonscript/compile/format.lua @@ -30,12 +30,10 @@ default_return = function(exp) local items = { "explist" } - do - local _item_0 = exp[3][2] - for _index_0 = 1, #_item_0 do - local v = _item_0[_index_0] - insert(items, v) - end + local _list_0 = exp[3][2] + for _index_0 = 1, #_list_0 do + local v = _list_0[_index_0] + insert(items, v) end return { "return", diff --git a/moonscript/compile/line.lua b/moonscript/compile/line.lua index e54ffba..a9296d1 100644 --- a/moonscript/compile/line.lua +++ b/moonscript/compile/line.lua @@ -24,13 +24,11 @@ line_compile = { _with_0:append_list((function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = names - for _index_0 = 1, #_item_0 do - local name = _item_0[_index_0] - _len_0 = _len_0 + 1 - _accum_0[_len_0] = self:name(name) - end + local _list_0 = names + for _index_0 = 1, #_list_0 do + local name = _list_0[_index_0] + _len_0 = _len_0 + 1 + _accum_0[_len_0] = self:name(name) end return _accum_0 end)(), ", ") @@ -78,13 +76,11 @@ line_compile = { _with_0:append_list((function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = names - for _index_0 = 1, #_item_0 do - local name = _item_0[_index_0] - _len_0 = _len_0 + 1 - _accum_0[_len_0] = self:value(name) - end + local _list_0 = names + for _index_0 = 1, #_list_0 do + local name = _list_0[_index_0] + _len_0 = _len_0 + 1 + _accum_0[_len_0] = self:value(name) end return _accum_0 end)(), ", ") @@ -93,13 +89,11 @@ line_compile = { _with_0:append_list((function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = values - for _index_0 = 1, #_item_0 do - local v = _item_0[_index_0] - _len_0 = _len_0 + 1 - _accum_0[_len_0] = self:value(v) - end + local _list_0 = values + for _index_0 = 1, #_list_0 do + local v = _list_0[_index_0] + _len_0 = _len_0 + 1 + _accum_0[_len_0] = self:value(v) end return _accum_0 end)(), ", ") @@ -141,21 +135,19 @@ line_compile = { import = function(self, node) local _, names, source = unpack(node) local final_names, to_bind = { }, { } - do - local _item_0 = names - for _index_0 = 1, #_item_0 do - local name = _item_0[_index_0] - local final - if ntype(name) == ":" then - local tmp = self:name(name[2]) - to_bind[tmp] = true - final = tmp - else - final = self:name(name) - end - self:put_name(final) - insert(final_names, final) + local _list_0 = names + for _index_0 = 1, #_list_0 do + local name = _list_0[_index_0] + local final + if ntype(name) == ":" then + local tmp = self:name(name[2]) + to_bind[tmp] = true + final = tmp + else + final = self:name(name) end + self:put_name(final) + insert(final_names, final) end local get_value get_value = function(name) @@ -169,13 +161,11 @@ line_compile = { local values = (function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = final_names - for _index_0 = 1, #_item_0 do - local name = _item_0[_index_0] - _len_0 = _len_0 + 1 - _accum_0[_len_0] = get_value(name) - end + local _list_1 = final_names + for _index_0 = 1, #_list_1 do + local name = _list_1[_index_0] + _len_0 = _len_0 + 1 + _accum_0[_len_0] = get_value(name) end return _accum_0 end)() @@ -191,20 +181,18 @@ line_compile = { do local _with_0 = self:block("do") source = _with_0:init_free_var("table", source) - do - local _item_0 = final_names - for _index_0 = 1, #_item_0 do - local name = _item_0[_index_0] - _with_0:stm({ - "assign", - { - name - }, - { - get_value(name) - } - }) - end + local _list_1 = final_names + for _index_0 = 1, #_list_1 do + local name = _list_1[_index_0] + _with_0:stm({ + "assign", + { + name + }, + { + get_value(name) + } + }) end return _with_0 end @@ -233,12 +221,10 @@ line_compile = { current.next = next current = next end - do - local _item_0 = node - for _index_0 = 4, #_item_0 do - local cond = _item_0[_index_0] - add_clause(cond) - end + local _list_0 = node + for _index_0 = 4, #_list_0 do + cond = _list_0[_index_0] + add_clause(cond) end return root end, @@ -289,13 +275,11 @@ line_compile = { _with_0:append_list((function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = names - for _index_0 = 1, #_item_0 do - local name = _item_0[_index_0] - _len_0 = _len_0 + 1 - _accum_0[_len_0] = self:name(name) - end + local _list_0 = names + for _index_0 = 1, #_list_0 do + local name = _list_0[_index_0] + _len_0 = _len_0 + 1 + _accum_0[_len_0] = self:name(name) end return _accum_0 end)(), ", ") diff --git a/moonscript/compile/value.lua b/moonscript/compile/value.lua index 8f5fbcb..1e5248f 100644 --- a/moonscript/compile/value.lua +++ b/moonscript/compile/value.lua @@ -71,13 +71,11 @@ value_compile = { _with_0:append_list((function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = node - for _index_0 = 2, #_item_0 do - local v = _item_0[_index_0] - _len_0 = _len_0 + 1 - _accum_0[_len_0] = self:value(v) - end + local _list_0 = node + for _index_0 = 2, #_list_0 do + local v = _list_0[_index_0] + _len_0 = _len_0 + 1 + _accum_0[_len_0] = self:value(v) end return _accum_0 end)(), ", ") @@ -169,12 +167,10 @@ value_compile = { local actions do local _with_0 = self:line() - do - local _item_0 = node - for _index_0 = 3, #_item_0 do - local action = _item_0[_index_0] - _with_0:append(chain_item(action)) - end + local _list_0 = node + for _index_0 = 3, #_list_0 do + local action = _list_0[_index_0] + _with_0:append(chain_item(action)) end actions = _with_0 end @@ -187,27 +183,25 @@ value_compile = { local arg_names = (function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = args - for _index_0 = 1, #_item_0 do - local arg = _item_0[_index_0] - local name, default_value = unpack(arg) - if type(name) == "string" then - name = name - else - if name[1] == "self" then - insert(self_args, name) - end - name = name[2] - end - if default_value then - insert(default_args, arg) - end - local _value_0 = name - if _value_0 ~= nil then - _len_0 = _len_0 + 1 - _accum_0[_len_0] = _value_0 + local _list_0 = args + for _index_0 = 1, #_list_0 do + local arg = _list_0[_index_0] + local name, default_value = unpack(arg) + if type(name) == "string" then + name = name + else + if name[1] == "self" then + insert(self_args, name) end + name = name[2] + end + if default_value then + insert(default_args, arg) + end + local _value_0 = name + if _value_0 ~= nil then + _len_0 = _len_0 + 1 + _accum_0[_len_0] = _value_0 end end return _accum_0 @@ -220,53 +214,47 @@ value_compile = { if #whitelist > 0 then _with_0:whitelist_names(whitelist) end - do - local _item_0 = arg_names - for _index_0 = 1, #_item_0 do - local name = _item_0[_index_0] - _with_0:put_name(name) - end + local _list_0 = arg_names + for _index_0 = 1, #_list_0 do + local name = _list_0[_index_0] + _with_0:put_name(name) end - do - local _item_0 = default_args - for _index_0 = 1, #_item_0 do - local default = _item_0[_index_0] - local name, value = unpack(default) - if type(name) == "table" then - name = name[2] - end - _with_0:stm({ - 'if', - { - 'exp', - name, - '==', - 'nil' - }, + local _list_1 = default_args + for _index_0 = 1, #_list_1 do + local default = _list_1[_index_0] + local name, value = unpack(default) + if type(name) == "table" then + name = name[2] + end + _with_0:stm({ + 'if', + { + 'exp', + name, + '==', + 'nil' + }, + { { + 'assign', { - 'assign', - { - name - }, - { - value - } + name + }, + { + value } } - }) - end + } + }) end local self_arg_values = (function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = self_args - for _index_0 = 1, #_item_0 do - local arg = _item_0[_index_0] - _len_0 = _len_0 + 1 - _accum_0[_len_0] = arg[2] - end + local _list_2 = self_args + for _index_0 = 1, #_list_2 do + local arg = _list_2[_index_0] + _len_0 = _len_0 + 1 + _accum_0[_len_0] = arg[2] end return _accum_0 end)() @@ -282,15 +270,13 @@ value_compile = { arg_names = (function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = args - for _index_0 = 1, #_item_0 do - local arg = _item_0[_index_0] - local _value_0 = arg[1] - if _value_0 ~= nil then - _len_0 = _len_0 + 1 - _accum_0[_len_0] = _value_0 - end + local _list_2 = args + for _index_0 = 1, #_list_2 do + local arg = _list_2[_index_0] + local _value_0 = arg[1] + if _value_0 ~= nil then + _len_0 = _len_0 + 1 + _accum_0[_len_0] = _value_0 end end return _accum_0 @@ -331,12 +317,10 @@ value_compile = { end end if items then - do - local _item_0 = items - for _index_0 = 1, #_item_0 do - local line = _item_0[_index_0] - _with_0:add(format_line(line)) - end + local _list_0 = items + for _index_0 = 1, #_list_0 do + local line = _list_0[_index_0] + _with_0:add(format_line(line)) end end return _with_0 diff --git a/moonscript/data.lua b/moonscript/data.lua index c6d9d93..d3e2c45 100644 --- a/moonscript/data.lua +++ b/moonscript/data.lua @@ -2,16 +2,15 @@ module("moonscript.data", package.seeall) local concat = table.concat Set = function(items) local self = { } - do - local _item_0 = items - for _index_0 = 1, #_item_0 do - local key = _item_0[_index_0] - self[key] = true - end + local _list_0 = items + for _index_0 = 1, #_list_0 do + local key = _list_0[_index_0] + self[key] = true end return self end -Stack = (function(_parent_0) +Stack = (function() + local _parent_0 = nil local _base_0 = { __tostring = function(self) return "" @@ -33,23 +32,21 @@ Stack = (function(_parent_0) end local _class_0 = setmetatable({ __init = function(self, ...) - do - local _item_0 = { - ... - } - for _index_0 = 1, #_item_0 do - local v = _item_0[_index_0] - self:push(v) - end + local _list_0 = { + ... + } + for _index_0 = 1, #_list_0 do + local v = _list_0[_index_0] + self:push(v) end return nil end }, { __index = _base_0, - __call = function(mt, ...) - local self = setmetatable({}, _base_0) - mt.__init(self, ...) - return self + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 end }) _base_0.__class = _class_0 diff --git a/moonscript/dump.lua b/moonscript/dump.lua index 780dea3..3754a60 100644 --- a/moonscript/dump.lua +++ b/moonscript/dump.lua @@ -13,13 +13,11 @@ flat_value = function(op, depth) local items = (function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = op - for _index_0 = 1, #_item_0 do - local item = _item_0[_index_0] - _len_0 = _len_0 + 1 - _accum_0[_len_0] = flat_value(item, depth + 1) - end + local _list_0 = op + for _index_0 = 1, #_list_0 do + local item = _list_0[_index_0] + _len_0 = _len_0 + 1 + _accum_0[_len_0] = flat_value(item, depth + 1) end return _accum_0 end)() @@ -33,13 +31,11 @@ tree = function(block) return (function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = block - for _index_0 = 1, #_item_0 do - local value = _item_0[_index_0] - _len_0 = _len_0 + 1 - _accum_0[_len_0] = print(flat_value(value)) - end + local _list_0 = block + for _index_0 = 1, #_list_0 do + value = _list_0[_index_0] + _len_0 = _len_0 + 1 + _accum_0[_len_0] = print(flat_value(value)) end return _accum_0 end)() diff --git a/moonscript/init.moon b/moonscript/init.moon index c315f8b..53c9744 100644 --- a/moonscript/init.moon +++ b/moonscript/init.moon @@ -8,7 +8,10 @@ require "moonscript.util" import concat, insert from table import split, dump from util -export moon_chunk, moon_loader, dirsep, line_tables +lua = :loadstring, :load + +export to_lua, moon_chunk, moon_loader, dirsep, line_tables +export dofile, loadfile, loadstring dirsep = "/" line_tables = {} @@ -21,22 +24,24 @@ create_moonpath = (package_path) -> if p then paths[i] = p..".moon" concat paths, ";" --- load the chunk function from a file objec: -moon_chunk = (file, file_path) -> - text = file\read "*a" - if not text then error "Could not read file" +to_lua = (text) -> tree, err = parse.string text if not tree - error "Parse error: " .. err + error "Parse error: " .. err, 2 code, ltable, pos = compile.tree tree if not code - error compile.format_error ltable, pos, text + error compile.format_error(ltable, pos, text), 2 - line_tables[file_path] = ltable + code, ltable + +-- load the chunk function from a file objec: +moon_chunk = (text, source_path) -> + code, ltable = to_lua text + line_tables[source_path] = ltable if source_path runner = -> with code do code = nil - load runner, file_path + lua.load runner, source_path moon_loader = (name) -> name_path = name\gsub "%.", dirsep @@ -48,6 +53,8 @@ moon_loader = (name) -> break if file if file + text = file\read "*a" + if not text then error "Could not read file", 2 moon_chunk file, file_path else nil, "Could not find moon file" @@ -61,3 +68,17 @@ init_loader = -> init_loader! if not _G.moon_no_loader +loadstring = (str) -> + code = to_lua str + lua.loadstring code + +loadfile = (fname) -> + file, err = io.open fname + return nil, err if not file + loadstring file\read "*a" + +-- throws errros +dofile = (fname) -> + f = assert loadfile fname + f! + diff --git a/moonscript/transform.lua b/moonscript/transform.lua index 6222145..65d73b6 100644 --- a/moonscript/transform.lua +++ b/moonscript/transform.lua @@ -4,7 +4,8 @@ local util = require("moonscript.util") local data = require("moonscript.data") local ntype, build, smart_node, is_slice = types.ntype, types.build, types.smart_node, types.is_slice local insert = table.insert -NameProxy = (function(_parent_0) +NameProxy = (function() + local _parent_0 = nil local _base_0 = { get_name = function(self, scope) if not self.name then @@ -19,23 +20,21 @@ NameProxy = (function(_parent_0) items = (function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = items - for _index_0 = 1, #_item_0 do - local i = _item_0[_index_0] - local _value_0 - if type(i) == "string" then - _value_0 = { - "dot", - i - } - else - _value_0 = i - end - if _value_0 ~= nil then - _len_0 = _len_0 + 1 - _accum_0[_len_0] = _value_0 - end + local _list_0 = items + for _index_0 = 1, #_list_0 do + local i = _list_0[_index_0] + local _value_0 + if type(i) == "string" then + _value_0 = { + "dot", + i + } + else + _value_0 = i + end + if _value_0 ~= nil then + _len_0 = _len_0 + 1 + _accum_0[_len_0] = _value_0 end end return _accum_0 @@ -73,16 +72,17 @@ NameProxy = (function(_parent_0) end }, { __index = _base_0, - __call = function(mt, ...) - local self = setmetatable({}, _base_0) - mt.__init(self, ...) - return self + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 end }) _base_0.__class = _class_0 return _class_0 end)() -Run = (function(_parent_0) +Run = (function() + local _parent_0 = nil local _base_0 = { call = function(self, state) return self.fn(state) @@ -99,10 +99,10 @@ Run = (function(_parent_0) end }, { __index = _base_0, - __call = function(mt, ...) - local self = setmetatable({}, _base_0) - mt.__init(self, ...) - return self + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 end }) _base_0.__class = _class_0 @@ -233,21 +233,19 @@ stm = Transformer({ local properties = (function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = tbl[2] - for _index_0 = 1, #_item_0 do - local entry = _item_0[_index_0] - local _value_0 - if entry[1] == constructor_name then - constructor = entry[2] - _value_0 = nil - else - _value_0 = entry - end - if _value_0 ~= nil then - _len_0 = _len_0 + 1 - _accum_0[_len_0] = _value_0 - end + local _list_0 = tbl[2] + for _index_0 = 1, #_list_0 do + local entry = _list_0[_index_0] + local _value_0 + if entry[1] == constructor_name then + constructor = entry[2] + _value_0 = nil + else + _value_0 = entry + end + if _value_0 ~= nil then + _len_0 = _len_0 + 1 + _accum_0[_len_0] = _value_0 end end return _accum_0 @@ -354,13 +352,11 @@ stm = Transformer({ local slice = (function() local _accum_0 = { } local _len_0 = 0 - do - local _item_0 = chain - for _index_0 = 3, #_item_0 do - local item = _item_0[_index_0] - _len_0 = _len_0 + 1 - _accum_0[_len_0] = item - end + local _list_0 = chain + for _index_0 = 3, #_list_0 do + local item = _list_0[_index_0] + _len_0 = _len_0 + 1 + _accum_0[_len_0] = item end return _accum_0 end)() diff --git a/moonscript/types.lua b/moonscript/types.lua index 1879e76..b3c1ce1 100644 --- a/moonscript/types.lua +++ b/moonscript/types.lua @@ -164,12 +164,10 @@ build = setmetatable({ "chain", base } - do - local _item_0 = parts - for _index_0 = 1, #_item_0 do - local part = _item_0[_index_0] - insert(node, part) - end + local _list_0 = parts + for _index_0 = 1, #_list_0 do + local part = _list_0[_index_0] + insert(node, part) end return node end