mirror of
https://github.com/leafo/moonscript.git
synced 2024-10-05 05:34:19 +00:00
super tests, fixed regression when compiling chain dot args
This commit is contained in:
parent
5c999fb680
commit
0d232f98e7
@ -109,7 +109,7 @@ value_compile = {
|
|||||||
elseif t == "index" then
|
elseif t == "index" then
|
||||||
return "[", self:value(arg), "]"
|
return "[", self:value(arg), "]"
|
||||||
elseif t == "dot" then
|
elseif t == "dot" then
|
||||||
return ".", self:value(arg)
|
return ".", tostring(arg)
|
||||||
elseif t == "colon" then
|
elseif t == "colon" then
|
||||||
return ":", arg, chain_item(node[3])
|
return ":", arg, chain_item(node[3])
|
||||||
elseif t == "colon_stub" then
|
elseif t == "colon_stub" then
|
||||||
|
@ -66,7 +66,7 @@ value_compile =
|
|||||||
elseif t == "index"
|
elseif t == "index"
|
||||||
"[", @value(arg), "]"
|
"[", @value(arg), "]"
|
||||||
elseif t == "dot"
|
elseif t == "dot"
|
||||||
".", @value arg
|
".", tostring arg
|
||||||
elseif t == "colon"
|
elseif t == "colon"
|
||||||
":", arg, chain_item(node[3])
|
":", arg, chain_item(node[3])
|
||||||
elseif t == "colon_stub"
|
elseif t == "colon_stub"
|
||||||
|
@ -69,3 +69,15 @@ with Hello!
|
|||||||
print x
|
print x
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -299,3 +299,38 @@ do
|
|||||||
print(x)
|
print(x)
|
||||||
x()
|
x()
|
||||||
end
|
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)()
|
Loading…
Reference in New Issue
Block a user