self operator uses : for funcalls

This commit is contained in:
leaf corcoran 2011-06-02 00:01:08 -07:00
parent 5e99633efc
commit fbf2e370a6

View File

@ -140,6 +140,11 @@ local compiler_index = {
table.insert(actions, self:chain_item(node[i]))
end
-- self function calls operate on self
if ntype(callee) == "self" and node[3] and ntype(node[3]) == "call" then
callee[1] = "self_colon"
end
local callee_value = self:value(callee)
if ntype(callee) == "exp" then
callee_value = "("..callee_value..")"
@ -522,6 +527,11 @@ local compiler_index = {
return "self."..self:value(val)
end,
self_colon = function(self, node)
local _, val = unpack(node)
return "self:"..self:value(val)
end,
-- a list of values
values = function(self, items, start)
start = start or 1