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]))
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user