diff --git a/moonscript/compile/value.lua b/moonscript/compile/value.lua index 6c4d0f1..0ad6f3f 100644 --- a/moonscript/compile/value.lua +++ b/moonscript/compile/value.lua @@ -309,8 +309,9 @@ value_compile = { return "self:" .. self:value(node[2]) end, raw_value = function(self, value) - if value == "super" then - return self:value(self:get("super")(self)) + local sup = self:get("super") + if value == "super" and sup then + return self:value(sup(self)) end if value == "..." then self.has_varargs = true diff --git a/moonscript/compile/value.moon b/moonscript/compile/value.moon index 5b8ac98..5d44cac 100644 --- a/moonscript/compile/value.moon +++ b/moonscript/compile/value.moon @@ -181,8 +181,9 @@ value_compile = -- catch all pure string values raw_value: (value) => - if value == "super" - return @value @get"super" self + sup = @get"super" + if value == "super" and sup + return @value sup self if value == "..." @has_varargs = true