Allow real statements inside of class

This commit is contained in:
leaf corcoran 2012-09-30 19:16:10 -07:00
parent 5e7520e491
commit 8cf92a3591
2 changed files with 47 additions and 47 deletions

View File

@ -501,7 +501,7 @@ local build_grammar = wrap_env(function()
Ct(ClassLine * (SpaceBreak^1 * ClassLine)^0) * PopIndent,
ClassLine = CheckIndent * ((
KeyValueList / mark"props" +
(Assign + Update) / mark"stm" +
Statement / mark"stm" +
Exp / mark"stm"
) * sym","^-1),

View File

@ -540,53 +540,53 @@ local self = self + self / self
self = 343
self.hello(2, 3, 4)
local _ = hello[self].world
if something then
local Whacko
Whacko = (function()
local hello
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
local Whacko
Whacko = (function()
local hello
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
})
_base_0.__class = _class_0
local self = _class_0
_ = self.hello
if something then
print("hello world")
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
hello = "world"
self.another = "day"
})
_base_0.__class = _class_0
local self = _class_0
_ = self.hello
if something then
print("hello world")
end
hello = "world"
self.another = "day"
if something then
print("yeah")
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
return _class_0
end)()
end
end
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
return _class_0
end)()
print("hello")