Permalink
Browse files

fixed regression, assign allowed in class decl again

  • Loading branch information...
1 parent b4d6f59 commit c93e2d35f5d55a1677a99a327498e3fc1033971a @leafo committed Jan 22, 2012
Showing with 63 additions and 1 deletion.
  1. +1 −0 moonscript/parse.lua
  2. +15 −0 tests/inputs/class.moon
  3. +47 −1 tests/outputs/class.lua
View
@@ -448,6 +448,7 @@ local build_grammar = wrap_env(function()
Ct(ClassLine * (SpaceBreak^1 * ClassLine)^0) * PopIndent,
ClassLine = CheckIndent * ((
KeyValueList / mark"props" +
+ (Assign + Update) / mark"stm" +
Exp / mark"stm"
) * sym","^-1),
View
@@ -115,3 +115,18 @@ y = @@
hello[@].world
+
+class Whacko
+ @hello
+ if something
+ print "hello world"
+
+ hello = "world"
+ @another = "day"
+
+ print "yeah" if something -- this is briken
+
+
+print "hello"
+
+
View
@@ -503,4 +503,50 @@ self.__class(something)
local self = self + self / self
self = 343
self.hello(2, 3, 4)
-local _ = hello[self].world
+local _ = hello[self].world
+if something then
+ local Whacko
+ Whacko = (function()
+ local _parent_0 = nil
+ local _base_0 = { }
+ _base_0.__index = _base_0
+ if _parent_0 then
+ setmetatable(_base_0, _parent_0.__base)
+ end
+ local _class_0 = setmetatable({
+ __init = function(self, ...)
+ if _parent_0 then
+ return _parent_0.__init(self, ...)
+ end
+ end,
+ __base = _base_0,
+ __name = "Whacko",
+ __parent = _parent_0
+ }, {
+ __index = function(cls, name)
+ local val = rawget(_base_0, name)
+ if val == nil and _parent_0 then
+ return _parent_0[name]
+ else
+ return val
+ end
+ end,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ local self = _class_0
+ _ = self.hello
+ if something then
+ print("hello world")
+ end
+ local hello = "world"
+ self.another = "day"
+ print("yeah")
+ return _class_0
+ end)()
+end
+print("hello")

0 comments on commit c93e2d3

Please sign in to comment.