don't create unnecessary tables

This commit is contained in:
leaf corcoran 2013-12-30 01:52:13 -08:00
parent 5d9ee66c14
commit 314272c376
2 changed files with 20 additions and 32 deletions

View File

@ -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

View File

@ -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"