mirror of
https://github.com/leafo/moonscript.git
synced 2025-01-09 00:04:22 +00:00
self operator uses :
for funcalls
This commit is contained in:
parent
5e99633efc
commit
fbf2e370a6
@ -140,6 +140,11 @@ local compiler_index = {
|
|||||||
table.insert(actions, self:chain_item(node[i]))
|
table.insert(actions, self:chain_item(node[i]))
|
||||||
end
|
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)
|
local callee_value = self:value(callee)
|
||||||
if ntype(callee) == "exp" then
|
if ntype(callee) == "exp" then
|
||||||
callee_value = "("..callee_value..")"
|
callee_value = "("..callee_value..")"
|
||||||
@ -522,6 +527,11 @@ local compiler_index = {
|
|||||||
return "self."..self:value(val)
|
return "self."..self:value(val)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
self_colon = function(self, node)
|
||||||
|
local _, val = unpack(node)
|
||||||
|
return "self:"..self:value(val)
|
||||||
|
end,
|
||||||
|
|
||||||
-- a list of values
|
-- a list of values
|
||||||
values = function(self, items, start)
|
values = function(self, items, start)
|
||||||
start = start or 1
|
start = start or 1
|
||||||
|
Loading…
Reference in New Issue
Block a user