mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
don't create unnecessary tables
This commit is contained in:
parent
5d9ee66c14
commit
314272c376
@ -47,31 +47,21 @@ do
|
||||
return self.name
|
||||
end,
|
||||
chain = function(self, ...)
|
||||
local items
|
||||
do
|
||||
local _accum_0 = { }
|
||||
local _len_0 = 1
|
||||
local _list_0 = {
|
||||
local items = {
|
||||
base = self,
|
||||
...
|
||||
}
|
||||
for _index_0 = 1, #_list_0 do
|
||||
local i = _list_0[_index_0]
|
||||
if type(i) == "string" then
|
||||
_accum_0[_len_0] = {
|
||||
for k, v in ipairs(items) do
|
||||
if type(v) == "string" then
|
||||
items[k] = {
|
||||
"dot",
|
||||
i
|
||||
v
|
||||
}
|
||||
else
|
||||
_accum_0[_len_0] = i
|
||||
items[k] = v
|
||||
end
|
||||
_len_0 = _len_0 + 1
|
||||
end
|
||||
items = _accum_0
|
||||
end
|
||||
return build.chain({
|
||||
base = self,
|
||||
unpack(items)
|
||||
})
|
||||
return build.chain(items)
|
||||
end,
|
||||
index = function(self, key)
|
||||
if type(key) == "string" then
|
||||
|
@ -18,16 +18,14 @@ class NameProxy
|
||||
@name
|
||||
|
||||
chain: (...) =>
|
||||
items = for i in *{...}
|
||||
if type(i) == "string"
|
||||
{"dot", i}
|
||||
items = { base: @, ... }
|
||||
for k,v in ipairs items
|
||||
items[k] = if type(v) == "string"
|
||||
{"dot", v}
|
||||
else
|
||||
i
|
||||
v
|
||||
|
||||
build.chain {
|
||||
base: self
|
||||
unpack items
|
||||
}
|
||||
build.chain items
|
||||
|
||||
index: (key) =>
|
||||
if type(key) == "string"
|
||||
|
Loading…
Reference in New Issue
Block a user