From cd5087b08b13bbe4b7e4e39cd2b21f9ab0fef4af Mon Sep 17 00:00:00 2001 From: leaf corcoran Date: Fri, 2 Dec 2011 20:42:46 -0800 Subject: [PATCH] don't error on value named super outside class --- moonscript/compile/value.lua | 5 +++-- moonscript/compile/value.moon | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) 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