moonscript/spec/outputs/class.lua

716 lines
15 KiB
Lua
Raw Normal View History

local Hello
do
2011-07-14 07:02:07 +00:00
local _base_0 = {
hello = function(self)
return print(self.test, self.world)
end,
__tostring = function(self)
return "hello world"
end
}
2011-06-15 15:52:01 +00:00
_base_0.__index = _base_0
2011-07-14 07:02:07 +00:00
local _class_0 = setmetatable({
__init = function(self, test, world)
2011-06-15 15:52:01 +00:00
self.test, self.world = test, world
return print("creating object..")
end,
__base = _base_0,
__name = "Hello"
2011-07-14 07:02:07 +00:00
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
2011-07-14 07:02:07 +00:00
end
})
2011-07-04 18:36:26 +00:00
_base_0.__class = _class_0
Hello = _class_0
end
2011-06-15 06:13:33 +00:00
local x = Hello(1, 2)
x:hello()
2011-06-16 05:41:17 +00:00
print(x)
local Simple
do
2011-07-14 07:02:07 +00:00
local _base_0 = {
cool = function(self)
return print("cool")
end
}
2011-06-16 05:41:17 +00:00
_base_0.__index = _base_0
2011-07-14 07:02:07 +00:00
local _class_0 = setmetatable({
__init = function() end,
__base = _base_0,
__name = "Simple"
2011-07-14 07:02:07 +00:00
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
2011-07-14 07:02:07 +00:00
end
})
2011-07-04 18:36:26 +00:00
_base_0.__class = _class_0
Simple = _class_0
end
local Yikes
do
local _parent_0 = Simple
2011-07-14 07:02:07 +00:00
local _base_0 = { }
2011-06-16 05:41:17 +00:00
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
2011-07-14 07:02:07 +00:00
local _class_0 = setmetatable({
__init = function(self)
return print("created hello")
end,
__base = _base_0,
__name = "Yikes",
__parent = _parent_0
2011-07-14 07:02:07 +00:00
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil 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
2011-07-14 07:02:07 +00:00
end
})
2011-07-04 18:36:26 +00:00
_base_0.__class = _class_0
if _parent_0.__inherited then
2012-09-09 00:52:26 +00:00
_parent_0.__inherited(_parent_0, _class_0)
end
Yikes = _class_0
end
2011-06-16 05:41:17 +00:00
x = Yikes()
x:cool()
local Hi
do
2011-07-14 07:02:07 +00:00
local _base_0 = {
cool = function(self, num)
return print("num", num)
end
}
_base_0.__index = _base_0
2011-07-14 07:02:07 +00:00
local _class_0 = setmetatable({
__init = function(self, arg)
return print("init arg", arg)
end,
__base = _base_0,
__name = "Hi"
2011-07-14 07:02:07 +00:00
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
2011-07-14 07:02:07 +00:00
end
})
2011-07-04 18:36:26 +00:00
_base_0.__class = _class_0
Hi = _class_0
end
do
local _parent_0 = Hi
2011-07-14 07:02:07 +00:00
local _base_0 = {
cool = function(self)
return _parent_0.cool(self, 120302)
end
}
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
2011-07-14 07:02:07 +00:00
local _class_0 = setmetatable({
__init = function(self)
return _parent_0.__init(self, "man")
end,
__base = _base_0,
__name = "Simple",
__parent = _parent_0
2011-07-14 07:02:07 +00:00
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil 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
2011-07-14 07:02:07 +00:00
end
})
2011-07-04 18:36:26 +00:00
_base_0.__class = _class_0
if _parent_0.__inherited then
2012-09-09 00:52:26 +00:00
_parent_0.__inherited(_parent_0, _class_0)
end
Simple = _class_0
end
x = Simple()
2011-07-04 18:36:26 +00:00
x:cool()
print(x.__class == Simple)
local Okay
do
local _base_0 = {
something = 20323
}
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function() end,
__base = _base_0,
__name = "Okay"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
Okay = _class_0
end
local Biggie
do
local _parent_0 = Okay
local _base_0 = {
something = function(self)
_parent_0.something(self, 1, 2, 3, 4)
_parent_0.something(another_self, 1, 2, 3, 4)
return assert(_parent_0 == Okay)
end
}
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
local _class_0 = setmetatable({
__init = function(self, ...)
return _parent_0.__init(self, ...)
end,
__base = _base_0,
__name = "Biggie",
__parent = _parent_0
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil 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
if _parent_0.__inherited then
2012-09-09 00:52:26 +00:00
_parent_0.__inherited(_parent_0, _class_0)
end
Biggie = _class_0
end
local Yeah
do
local _base_0 = {
okay = function(self)
return _parent_0.something(self, 1, 2, 3, 4)
end
}
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function() end,
__base = _base_0,
__name = "Yeah"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
Yeah = _class_0
end
local What
do
local _base_0 = {
something = function(self)
return print("val:", self.val)
end
}
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function() end,
__base = _base_0,
__name = "What"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
What = _class_0
end
do
local _parent_0 = What
local _base_0 = {
val = 2323,
something = function(self)
return (function()
local _base_1 = _parent_0
local _fn_0 = _base_1.something
return function(...)
return _fn_0(self, ...)
end
end)()
end
}
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
local _class_0 = setmetatable({
__init = function(self, ...)
return _parent_0.__init(self, ...)
end,
__base = _base_0,
__name = "Hello",
__parent = _parent_0
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil 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
if _parent_0.__inherited then
2012-09-09 00:52:26 +00:00
_parent_0.__inherited(_parent_0, _class_0)
end
Hello = _class_0
end
do
local _with_0 = Hello()
x = _with_0:something()
print(x)
x()
end
local CoolSuper
do
local _base_0 = {
hi = function(self)
_parent_0.hi(self, 1, 2, 3, 4)(1, 2, 3, 4)
_parent_0.something(1, 2, 3, 4)
local _ = _parent_0.something(1, 2, 3, 4).world
_parent_0.yeah(self, "world").okay(hi, hi, hi)
_ = something.super
_ = _parent_0.super.super.super
return nil
end
}
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function() end,
__base = _base_0,
__name = "CoolSuper"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
CoolSuper = _class_0
end
2012-01-09 06:24:58 +00:00
x = self.hello
x = self.__class.hello
self:hello("world")
self.__class:hello("world")
self.__class:one(self.__class:two(4, 5)(self.three, self.four))
local xx
xx = function(hello, world, cool)
self.hello, self.__class.world = hello, world
end
local ClassMan
do
local _base_0 = {
blue = function(self) end,
green = function(self) end
}
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function() end,
__base = _base_0,
__name = "ClassMan"
}, {
__index = _base_0,
__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.yeah = 343
self.hello = 3434
self.world = 23423
self.red = function(self) end
ClassMan = _class_0
end
2012-01-12 04:39:09 +00:00
x = self
local y = self.__class
self(something)
self.__class(something)
local self = self + self / self
self = 343
self.hello(2, 3, 4)
local _ = hello[self].world
2012-10-01 02:16:10 +00:00
local Whacko
do
2012-10-01 02:16:10 +00:00
local hello
local _base_0 = { }
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function() end,
2012-10-01 02:16:10 +00:00
__base = _base_0,
__name = "Whacko"
2012-10-01 02:16:10 +00:00
}, {
__index = _base_0,
2012-10-01 02:16:10 +00:00
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
2012-10-01 02:16:10 +00:00
})
_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")
2012-10-01 02:16:10 +00:00
end
Whacko = _class_0
end
2012-10-30 16:44:02 +00:00
print("hello")
local yyy
yyy = function()
local Cool
do
2012-10-30 16:44:02 +00:00
local _base_0 = { }
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function() end,
2012-10-30 16:44:02 +00:00
__base = _base_0,
__name = "Cool"
2012-10-30 16:44:02 +00:00
}, {
__index = _base_0,
2012-10-30 16:44:02 +00:00
__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
_ = nil
Cool = _class_0
return _class_0
end
end
do
local _base_0 = { }
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function() end,
__base = _base_0,
__name = "D"
}, {
__index = _base_0,
__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
_ = nil
a.b.c.D = _class_0
end
do
local _base_0 = { }
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function() end,
__base = _base_0,
__name = "hello"
}, {
__index = _base_0,
__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
_ = nil
a.b["hello"] = _class_0
end
do
local _parent_0 = Hello.World
local _base_0 = { }
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
local _class_0 = setmetatable({
__init = function(self, ...)
return _parent_0.__init(self, ...)
end,
__base = _base_0,
__name = "Something",
__parent = _parent_0
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil 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
_ = nil
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
(function()
return require("moon")
end)().Something = _class_0
end
local a
do
local _base_0 = { }
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function() end,
__base = _base_0,
__name = "a"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
a = _class_0
end
local b
local Something
do
local _base_0 = { }
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function() end,
__base = _base_0,
__name = "Something"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
Something = _class_0
b = _class_0
end
local c
do
local _parent_0 = Hello
local _base_0 = { }
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
local _class_0 = setmetatable({
__init = function(self, ...)
return _parent_0.__init(self, ...)
end,
__base = _base_0,
__name = "Something",
__parent = _parent_0
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil 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
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Something = _class_0
c = _class_0
end
local d
do
local _parent_0 = World
local _base_0 = { }
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
local _class_0 = setmetatable({
__init = function(self, ...)
return _parent_0.__init(self, ...)
end,
__base = _base_0,
__name = "d",
__parent = _parent_0
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil 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
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
d = _class_0
end
print(((function()
local WhatsUp
do
local _base_0 = { }
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function() end,
__base = _base_0,
__name = "WhatsUp"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
WhatsUp = _class_0
return _class_0
end
end)()).__name)
do
local _base_0 = { }
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function() end,
__base = _base_0,
__name = "Something"
}, {
__index = _base_0,
__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
_ = nil
Something = _class_0
end
do
local val, insert
local _base_0 = { }
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function(self)
return print(insert, val)
end,
__base = _base_0,
__name = "Something"
}, {
__index = _base_0,
__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
val = 23
do
local _obj_0 = table
insert = _obj_0.insert
end
Something = _class_0
end
2013-01-24 01:50:36 +00:00
do
local _base_0 = { }
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = hi,
__base = _base_0,
__name = "X"
2013-01-24 01:50:36 +00:00
}, {
__index = _base_0,
2013-01-24 01:50:36 +00:00
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
X = _class_0
end
return nil