diff --git a/moonscript/compile/value.lua b/moonscript/compile/value.lua index 0ad6f3f..677f958 100644 --- a/moonscript/compile/value.lua +++ b/moonscript/compile/value.lua @@ -109,7 +109,7 @@ value_compile = { elseif t == "index" then return "[", self:value(arg), "]" elseif t == "dot" then - return ".", self:value(arg) + return ".", tostring(arg) elseif t == "colon" then return ":", arg, chain_item(node[3]) elseif t == "colon_stub" then diff --git a/moonscript/compile/value.moon b/moonscript/compile/value.moon index 5d44cac..67166a7 100644 --- a/moonscript/compile/value.moon +++ b/moonscript/compile/value.moon @@ -66,7 +66,7 @@ value_compile = elseif t == "index" "[", @value(arg), "]" elseif t == "dot" - ".", @value arg + ".", tostring arg elseif t == "colon" ":", arg, chain_item(node[3]) elseif t == "colon_stub" diff --git a/tests/inputs/class.moon b/tests/inputs/class.moon index a03a3eb..629a63f 100644 --- a/tests/inputs/class.moon +++ b/tests/inputs/class.moon @@ -69,3 +69,15 @@ with Hello! print x x! +class CoolSuper + hi: => + super(1,2,3,4) 1,2,3,4 + super.something 1,2,3,4 + super.something(1,2,3,4).world + super\yeah"world".okay hi, hi, hi + something.super + super.super.super.super + nil + + + diff --git a/tests/outputs/class.lua b/tests/outputs/class.lua index ccc3c02..b601e4e 100644 --- a/tests/outputs/class.lua +++ b/tests/outputs/class.lua @@ -298,4 +298,39 @@ do x = _with_0:something() print(x) x() -end \ No newline at end of file +end +local CoolSuper +CoolSuper = (function() + local _parent_0 = nil + local _base_0 = { + hi = function(self) + _parent_0.hi(self, 1, 2, 3, 4)(1, 2, 3, 4) + _parent_0.something(1, 2, 3, 4) + local _ = _parent_0.something(1, 2, 3, 4).world + _parent_0.yeah(self, "world").okay(hi, hi, hi) + _ = something.super + _ = _parent_0.super.super.super + return nil + end + } + _base_0.__index = _base_0 + if _parent_0 then + setmetatable(_base_0, getmetatable(_parent_0).__index) + end + local _class_0 = setmetatable({ + __init = function(self, ...) + if _parent_0 then + return _parent_0.__init(self, ...) + end + end + }, { + __index = _base_0, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + return _class_0 +end)() \ No newline at end of file