1313 local _obj_0 = require (" moonscript.types" )
1414 build , ntype , NOOP = _obj_0 .build , _obj_0 .ntype , _obj_0 .NOOP
1515end
16+ local unpack
17+ unpack = require (" moonscript.util" ).unpack
1618local transform_super
17- transform_super = function (cls_name , block , chain )
19+ transform_super = function (cls_name , on_base , block , chain )
20+ if on_base == nil then
21+ on_base = true
22+ end
1823 local relative_parent = {
1924 " chain" ,
2025 cls_name ,
@@ -36,6 +41,12 @@ transform_super = function(cls_name, block, chain)
3641 local new_chain = relative_parent
3742 local _exp_0 = head [1 ]
3843 if " call" == _exp_0 then
44+ if on_base then
45+ insert (new_chain , {
46+ " dot" ,
47+ " __base"
48+ })
49+ end
3950 local calling_name = block :get (" current_method" )
4051 assert (calling_name , " missing calling name" )
4152 chain_tail [1 ] = {
@@ -103,9 +114,13 @@ return function(self, node, ret, parent_assign)
103114 local base_name = NameProxy (" base" )
104115 local self_name = NameProxy (" self" )
105116 local cls_name = NameProxy (" class" )
117+ local cls_instance_super
118+ cls_instance_super = function (...)
119+ return transform_super (cls_name , true , ... )
120+ end
106121 local cls_super
107122 cls_super = function (...)
108- return transform_super (cls_name , ... )
123+ return transform_super (cls_name , false , ... )
109124 end
110125 local statements = { }
111126 local properties = { }
@@ -150,7 +165,7 @@ return function(self, node, ret, parent_assign)
150165 key , val = tuple [1 ], tuple [2 ]
151166 _value_0 = {
152167 key ,
153- super_scope (val , cls_super , key )
168+ super_scope (val , cls_instance_super , key )
154169 }
155170 end
156171 _accum_0 [_len_0 ] = _value_0
0 commit comments