super works inside class methods

This commit is contained in:
leaf corcoran 2015-12-06 11:05:34 -08:00
parent 3be7be0166
commit a9bb80159f
2 changed files with 10 additions and 2 deletions

View File

@ -118,7 +118,13 @@ return function(self, node, ret, parent_assign)
for _index_1 = 2, #item do
local tuple = item[_index_1]
if ntype(tuple[1]) == "self" then
insert(statements, build.assign_one(unpack(tuple)))
local k, v
k, v = tuple[1], tuple[2]
v = super_scope(v, cls_super, {
"key_literal",
k[2]
})
insert(statements, build.assign_one(k, v))
else
insert(properties, tuple)
end

View File

@ -92,7 +92,9 @@ super_scope = (value, t, key) ->
when "props"
for tuple in *item[2,]
if ntype(tuple[1]) == "self"
insert statements, build.assign_one unpack tuple
{k,v} = tuple
v = super_scope v, cls_super, {"key_literal", k[2]}
insert statements, build.assign_one k, v
else
insert properties, tuple