Skip to content

Commit 7aa63b2

Browse files
committed
update specs for new class super
1 parent 7eb269b commit 7aa63b2

File tree

2 files changed

+84
-9
lines changed

2 files changed

+84
-9
lines changed

spec/inputs/class.moon

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,28 @@ class Cool extends Thing
186186
world: -> super.one
187187
}
188188

189-
190189
--
191190

192-
class Cool extends Thing
191+
class Whack extends Thing
193192
dang: do_something =>
194193
super!
195194

195+
---
196+
197+
class Wowha extends Thing
198+
@butt: ->
199+
super!
200+
super.hello
201+
super\hello!
202+
super\hello
203+
196204

205+
@butt: cool {
206+
->
207+
super!
208+
super.hello
209+
super\hello!
210+
super\hello
211+
}
197212

198213
nil

spec/outputs/class.lua

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ do
126126
local _parent_0 = Hi
127127
local _base_0 = {
128128
cool = function(self)
129-
return _class_0.__parent.cool(self, 120302)
129+
return _class_0.__parent.__base.cool(self, 120302)
130130
end
131131
}
132132
_base_0.__index = _base_0
@@ -193,7 +193,7 @@ do
193193
local _parent_0 = Okay
194194
local _base_0 = {
195195
something = function(self)
196-
_class_0.__parent.something(self, 1, 2, 3, 4)
196+
_class_0.__parent.__base.something(self, 1, 2, 3, 4)
197197
_class_0.__parent.something(another_self, 1, 2, 3, 4)
198198
return assert(_class_0.__parent == Okay)
199199
end
@@ -336,7 +336,7 @@ do
336336
local _class_0
337337
local _base_0 = {
338338
hi = function(self)
339-
_class_0.__parent.hi(self, 1, 2, 3, 4)(1, 2, 3, 4)
339+
_class_0.__parent.__base.hi(self, 1, 2, 3, 4)(1, 2, 3, 4)
340340
_class_0.__parent.something(1, 2, 3, 4)
341341
local _ = _class_0.__parent.something(1, 2, 3, 4).world
342342
_class_0.__parent.yeah(self, "world").okay(hi, hi, hi)
@@ -768,7 +768,7 @@ do
768768
dang = function(self)
769769
return {
770770
hello = function()
771-
return _class_0.__parent.dang(self)
771+
return _class_0.__parent.__base.dang(self)
772772
end,
773773
world = function()
774774
return _class_0.__parent.one
@@ -814,7 +814,7 @@ do
814814
local _parent_0 = Thing
815815
local _base_0 = {
816816
dang = do_something(function(self)
817-
return _class_0.__parent.dang(self)
817+
return _class_0.__parent.__base.dang(self)
818818
end)
819819
}
820820
_base_0.__index = _base_0
@@ -824,7 +824,7 @@ do
824824
return _class_0.__parent.__init(self, ...)
825825
end,
826826
__base = _base_0,
827-
__name = "Cool",
827+
__name = "Whack",
828828
__parent = _parent_0
829829
}, {
830830
__index = function(cls, name)
@@ -848,6 +848,66 @@ do
848848
if _parent_0.__inherited then
849849
_parent_0.__inherited(_parent_0, _class_0)
850850
end
851-
Cool = _class_0
851+
Whack = _class_0
852+
end
853+
do
854+
local _class_0
855+
local _parent_0 = Thing
856+
local _base_0 = { }
857+
_base_0.__index = _base_0
858+
setmetatable(_base_0, _parent_0.__base)
859+
_class_0 = setmetatable({
860+
__init = function(self, ...)
861+
return _class_0.__parent.__init(self, ...)
862+
end,
863+
__base = _base_0,
864+
__name = "Wowha",
865+
__parent = _parent_0
866+
}, {
867+
__index = function(cls, name)
868+
local val = rawget(_base_0, name)
869+
if val == nil then
870+
local parent = rawget(cls, "__parent")
871+
if parent then
872+
return parent[name]
873+
end
874+
else
875+
return val
876+
end
877+
end,
878+
__call = function(cls, ...)
879+
local _self_0 = setmetatable({}, _base_0)
880+
cls.__init(_self_0, ...)
881+
return _self_0
882+
end
883+
})
884+
_base_0.__class = _class_0
885+
local self = _class_0
886+
self.butt = function()
887+
_class_0.__parent.butt(self)
888+
_ = _class_0.__parent.hello
889+
_class_0.__parent.hello(self)
890+
local _base_1 = _class_0.__parent
891+
local _fn_0 = _base_1.hello
892+
return function(...)
893+
return _fn_0(self, ...)
894+
end
895+
end
896+
self.butt = cool({
897+
function()
898+
_class_0.__parent.butt(self)
899+
_ = _class_0.__parent.hello
900+
_class_0.__parent.hello(self)
901+
local _base_1 = _class_0.__parent
902+
local _fn_0 = _base_1.hello
903+
return function(...)
904+
return _fn_0(self, ...)
905+
end
906+
end
907+
})
908+
if _parent_0.__inherited then
909+
_parent_0.__inherited(_parent_0, _class_0)
910+
end
911+
Wowha = _class_0
852912
end
853913
return nil

0 commit comments

Comments
 (0)