don't generate unecessary code for classes

This commit is contained in:
leaf corcoran 2013-06-25 20:05:20 -07:00
parent 3a7f5503ce
commit a41637ba1e
4 changed files with 205 additions and 577 deletions

View File

@ -888,6 +888,9 @@ Statement = Transformer({
end,
class = function(self, node, ret, parent_assign)
local _, name, parent_val, body = unpack(node)
if parent_val == "" then
parent_val = nil
end
local statements = { }
local properties = { }
for _index_0 = 1, #body do
@ -939,30 +942,29 @@ Statement = Transformer({
local self_name = NameProxy("self")
local cls_name = NameProxy("class")
if not (constructor) then
constructor = build.fndef({
args = {
{
"..."
}
},
arrow = "fat",
body = {
build["if"]({
cond = parent_cls_name,
["then"] = {
build.chain({
base = "super",
{
"call",
{
"..."
}
}
})
if parent_val then
constructor = build.fndef({
args = {
{
"..."
}
})
}
})
},
arrow = "fat",
body = {
build.chain({
base = "super",
{
"call",
{
"..."
}
}
})
}
})
else
constructor = build.fndef()
end
end
local real_name = name or parent_assign and parent_assign[2][1]
local _exp_0 = ntype(real_name)
@ -1002,56 +1004,60 @@ Statement = Transformer({
"__name",
real_name
},
{
parent_val and {
"__parent",
parent_cls_name
}
})
local class_lookup = build["if"]({
cond = {
"exp",
"val",
"==",
"nil",
"and",
parent_cls_name
},
["then"] = {
parent_cls_name:index("name")
}
})
insert(class_lookup, {
"else",
{
"val"
}
} or nil
})
local class_index
if parent_val then
local class_lookup = build["if"]({
cond = {
"exp",
"val",
"==",
"nil"
},
["then"] = {
parent_cls_name:index("name")
}
})
insert(class_lookup, {
"else",
{
"val"
}
})
class_index = build.fndef({
args = {
{
"cls"
},
{
"name"
}
},
body = {
build.assign_one(LocalName("val"), build.chain({
base = "rawget",
{
"call",
{
base_name,
"name"
}
}
})),
class_lookup
}
})
else
class_index = base_name
end
local cls_mt = build.table({
{
"__index",
build.fndef({
args = {
{
"cls"
},
{
"name"
}
},
body = {
build.assign_one(LocalName("val"), build.chain({
base = "rawget",
{
"call",
{
base_name,
"name"
}
}
})),
class_lookup
}
})
class_index
},
{
"__call",
@ -1174,33 +1180,28 @@ Statement = Transformer({
"declare_glob",
"*"
},
build.assign_one(parent_cls_name, parent_val == "" and "nil" or parent_val),
parent_val and build.assign_one(parent_cls_name, parent_val) or NOOP,
build.assign_one(base_name, {
"table",
properties
}),
build.assign_one(base_name:chain("__index"), base_name),
build["if"]({
cond = parent_cls_name,
["then"] = {
build.chain({
base = "setmetatable",
{
"call",
parent_val and build.chain({
base = "setmetatable",
{
"call",
{
base_name,
build.chain({
base = parent_cls_name,
{
base_name,
build.chain({
base = parent_cls_name,
{
"dot",
"__base"
}
})
"dot",
"__base"
}
}
})
})
}
}
}),
}) or NOOP,
build.assign_one(cls_name, cls),
build.assign_one(base_name:chain("__class"), cls_name),
build.group((function()
@ -1211,11 +1212,9 @@ Statement = Transformer({
}
end
end)()),
build["if"]({
parent_val and build["if"]({
cond = {
"exp",
parent_cls_name,
"and",
parent_cls_name:chain("__inherited")
},
["then"] = {
@ -1227,7 +1226,7 @@ Statement = Transformer({
}
})
}
}),
}) or NOOP,
build.group((function()
if name then
return {

View File

@ -502,6 +502,7 @@ Statement = Transformer {
class: (node, ret, parent_assign) =>
_, name, parent_val, body = unpack node
parent_val = nil if parent_val == ""
-- split apart properties and statements
statements = {}
@ -533,18 +534,16 @@ Statement = Transformer {
cls_name = NameProxy "class"
unless constructor
constructor = build.fndef {
args: {{"..."}}
arrow: "fat"
body: {
build["if"] {
cond: parent_cls_name
then: {
build.chain { base: "super", {"call", {"..."}} }
}
constructor = if parent_val
build.fndef {
args: {{"..."}}
arrow: "fat"
body: {
build.chain { base: "super", {"call", {"..."}} }
}
}
}
else
build.fndef!
real_name = name or parent_assign and parent_assign[2][1]
real_name = switch ntype real_name
@ -566,20 +565,20 @@ Statement = Transformer {
{"__init", constructor}
{"__base", base_name}
{"__name", real_name} -- "quote the string"
{"__parent", parent_cls_name}
parent_val and {"__parent", parent_cls_name} or nil
}
-- look up a name in the class object
class_lookup = build["if"] {
cond: {"exp", "val", "==", "nil", "and", parent_cls_name}
then: {
parent_cls_name\index"name"
-- looking up a name in the class object
class_index = if parent_val
class_lookup = build["if"] {
cond: { "exp", "val", "==", "nil" }
then: {
parent_cls_name\index"name"
}
}
}
insert class_lookup, {"else", {"val"}}
insert class_lookup, {"else", {"val"}}
cls_mt = build.table {
{"__index", build.fndef {
build.fndef {
args: {{"cls"}, {"name"}}
body: {
build.assign_one LocalName"val", build.chain {
@ -587,7 +586,12 @@ Statement = Transformer {
}
class_lookup
}
}}
}
else
base_name
cls_mt = build.table {
{"__index", class_index}
{"__call", build.fndef {
args: {{"cls"}, {"..."}}
body: {
@ -651,22 +655,18 @@ Statement = Transformer {
{"declare_glob", "*"}
.assign_one parent_cls_name, parent_val == "" and "nil" or parent_val
parent_val and .assign_one(parent_cls_name, parent_val) or NOOP
.assign_one base_name, {"table", properties}
.assign_one base_name\chain"__index", base_name
.if {
cond: parent_cls_name
then: {
.chain {
base: "setmetatable"
{"call", {
base_name,
.chain { base: parent_cls_name, {"dot", "__base"}}
}}
}
}
}
parent_val and .chain({
base: "setmetatable"
{"call", {
base_name,
.chain { base: parent_cls_name, {"dot", "__base"}}
}}
}) or NOOP
.assign_one cls_name, cls
.assign_one base_name\chain"__class", cls_name
@ -677,16 +677,14 @@ Statement = Transformer {
}
-- run the inherited callback
.if {
cond: {"exp",
parent_cls_name, "and", parent_cls_name\chain "__inherited"
}
parent_val and .if({
cond: {"exp", parent_cls_name\chain "__inherited" }
then: {
parent_cls_name\chain "__inherited", {"call", {
parent_cls_name, cls_name
}}
}
}
}) or NOOP
.group if name then {
.assign_one name, cls_name

View File

@ -1,6 +1,5 @@
local Hello
do
local _parent_0 = nil
local _base_0 = {
hello = function(self)
return print(self.test, self.world)
@ -10,26 +9,15 @@ do
end
}
_base_0.__index = _base_0
if _parent_0 then
setmetatable(_base_0, _parent_0.__base)
end
local _class_0 = setmetatable({
__init = function(self, test, world)
self.test, self.world = test, world
return print("creating object..")
end,
__base = _base_0,
__name = "Hello",
__parent = _parent_0
__name = "Hello"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -37,9 +25,6 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Hello = _class_0
end
local x = Hello(1, 2)
@ -47,34 +32,18 @@ x:hello()
print(x)
local Simple
do
local _parent_0 = nil
local _base_0 = {
cool = function(self)
return print("cool")
end
}
_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,
__init = function() end,
__base = _base_0,
__name = "Simple",
__parent = _parent_0
__name = "Simple"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -82,9 +51,6 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Simple = _class_0
end
local Yikes
@ -92,9 +58,7 @@ do
local _parent_0 = Simple
local _base_0 = { }
_base_0.__index = _base_0
if _parent_0 then
setmetatable(_base_0, _parent_0.__base)
end
setmetatable(_base_0, _parent_0.__base)
local _class_0 = setmetatable({
__init = function(self)
return print("created hello")
@ -105,7 +69,7 @@ do
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil and _parent_0 then
if val == nil then
return _parent_0[name]
else
return val
@ -118,7 +82,7 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Yikes = _class_0
@ -127,32 +91,20 @@ x = Yikes()
x:cool()
local Hi
do
local _parent_0 = nil
local _base_0 = {
cool = function(self, num)
return print("num", num)
end
}
_base_0.__index = _base_0
if _parent_0 then
setmetatable(_base_0, _parent_0.__base)
end
local _class_0 = setmetatable({
__init = function(self, arg)
return print("init arg", arg)
end,
__base = _base_0,
__name = "Hi",
__parent = _parent_0
__name = "Hi"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -160,9 +112,6 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Hi = _class_0
end
do
@ -173,9 +122,7 @@ do
end
}
_base_0.__index = _base_0
if _parent_0 then
setmetatable(_base_0, _parent_0.__base)
end
setmetatable(_base_0, _parent_0.__base)
local _class_0 = setmetatable({
__init = function(self)
return _parent_0.__init(self, "man")
@ -186,7 +133,7 @@ do
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil and _parent_0 then
if val == nil then
return _parent_0[name]
else
return val
@ -199,7 +146,7 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Simple = _class_0
@ -209,32 +156,16 @@ x:cool()
print(x.__class == Simple)
local Okay
do
local _parent_0 = nil
local _base_0 = {
something = 20323
}
_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,
__init = function() end,
__base = _base_0,
__name = "Okay",
__parent = _parent_0
__name = "Okay"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -242,9 +173,6 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Okay = _class_0
end
local Biggie
@ -258,14 +186,10 @@ do
end
}
_base_0.__index = _base_0
if _parent_0 then
setmetatable(_base_0, _parent_0.__base)
end
setmetatable(_base_0, _parent_0.__base)
local _class_0 = setmetatable({
__init = function(self, ...)
if _parent_0 then
return _parent_0.__init(self, ...)
end
return _parent_0.__init(self, ...)
end,
__base = _base_0,
__name = "Biggie",
@ -273,7 +197,7 @@ do
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil and _parent_0 then
if val == nil then
return _parent_0[name]
else
return val
@ -286,41 +210,25 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Biggie = _class_0
end
local Yeah
do
local _parent_0 = nil
local _base_0 = {
okay = function(self)
return _parent_0.something(self, 1, 2, 3, 4)
end
}
_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,
__init = function() end,
__base = _base_0,
__name = "Yeah",
__parent = _parent_0
__name = "Yeah"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -328,41 +236,22 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Yeah = _class_0
end
local What
do
local _parent_0 = nil
local _base_0 = {
something = function(self)
return print("val:", self.val)
end
}
_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,
__init = function() end,
__base = _base_0,
__name = "What",
__parent = _parent_0
__name = "What"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -370,9 +259,6 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
What = _class_0
end
do
@ -390,14 +276,10 @@ do
end
}
_base_0.__index = _base_0
if _parent_0 then
setmetatable(_base_0, _parent_0.__base)
end
setmetatable(_base_0, _parent_0.__base)
local _class_0 = setmetatable({
__init = function(self, ...)
if _parent_0 then
return _parent_0.__init(self, ...)
end
return _parent_0.__init(self, ...)
end,
__base = _base_0,
__name = "Hello",
@ -405,7 +287,7 @@ do
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil and _parent_0 then
if val == nil then
return _parent_0[name]
else
return val
@ -418,7 +300,7 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Hello = _class_0
@ -431,7 +313,6 @@ do
end
local CoolSuper
do
local _parent_0 = nil
local _base_0 = {
hi = function(self)
_parent_0.hi(self, 1, 2, 3, 4)(1, 2, 3, 4)
@ -444,27 +325,12 @@ do
end
}
_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,
__init = function() end,
__base = _base_0,
__name = "CoolSuper",
__parent = _parent_0
__name = "CoolSuper"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -472,9 +338,6 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
CoolSuper = _class_0
end
x = self.hello
@ -488,33 +351,17 @@ xx = function(hello, world, cool)
end
local ClassMan
do
local _parent_0 = nil
local _base_0 = {
blue = function(self) end,
green = function(self) end
}
_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,
__init = function() end,
__base = _base_0,
__name = "ClassMan",
__parent = _parent_0
__name = "ClassMan"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -527,9 +374,6 @@ do
self.hello = 3434
self.world = 23423
self.red = function(self) end
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
ClassMan = _class_0
end
x = self
@ -543,30 +387,14 @@ local _ = hello[self].world
local Whacko
do
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,
__init = function() end,
__base = _base_0,
__name = "Whacko",
__parent = _parent_0
__name = "Whacko"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -584,9 +412,6 @@ do
if something then
print("yeah")
end
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Whacko = _class_0
end
print("hello")
@ -594,30 +419,14 @@ local yyy
yyy = function()
local Cool
do
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,
__init = function() end,
__base = _base_0,
__name = "Cool",
__parent = _parent_0
__name = "Cool"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -627,38 +436,19 @@ yyy = function()
_base_0.__class = _class_0
local self = _class_0
_ = nil
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Cool = _class_0
return _class_0
end
end
do
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,
__init = function() end,
__base = _base_0,
__name = "D",
__parent = _parent_0
__name = "D"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -668,36 +458,17 @@ do
_base_0.__class = _class_0
local self = _class_0
_ = nil
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
a.b.c.D = _class_0
end
do
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,
__init = function() end,
__base = _base_0,
__name = "hello",
__parent = _parent_0
__name = "hello"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -707,23 +478,16 @@ do
_base_0.__class = _class_0
local self = _class_0
_ = nil
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
a.b["hello"] = _class_0
end
do
local _parent_0 = Hello.World
local _base_0 = { }
_base_0.__index = _base_0
if _parent_0 then
setmetatable(_base_0, _parent_0.__base)
end
setmetatable(_base_0, _parent_0.__base)
local _class_0 = setmetatable({
__init = function(self, ...)
if _parent_0 then
return _parent_0.__init(self, ...)
end
return _parent_0.__init(self, ...)
end,
__base = _base_0,
__name = "Something",
@ -731,7 +495,7 @@ do
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil and _parent_0 then
if val == nil then
return _parent_0[name]
else
return val
@ -746,7 +510,7 @@ do
_base_0.__class = _class_0
local self = _class_0
_ = nil
if _parent_0 and _parent_0.__inherited then
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
(function()
@ -755,30 +519,14 @@ do
end
local a
do
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,
__init = function() end,
__base = _base_0,
__name = "a",
__parent = _parent_0
__name = "a"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -786,38 +534,19 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
a = _class_0
end
local b
local Something
do
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,
__init = function() end,
__base = _base_0,
__name = "Something",
__parent = _parent_0
__name = "Something"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -825,9 +554,6 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Something = _class_0
b = _class_0
end
@ -836,14 +562,10 @@ do
local _parent_0 = Hello
local _base_0 = { }
_base_0.__index = _base_0
if _parent_0 then
setmetatable(_base_0, _parent_0.__base)
end
setmetatable(_base_0, _parent_0.__base)
local _class_0 = setmetatable({
__init = function(self, ...)
if _parent_0 then
return _parent_0.__init(self, ...)
end
return _parent_0.__init(self, ...)
end,
__base = _base_0,
__name = "Something",
@ -851,7 +573,7 @@ do
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil and _parent_0 then
if val == nil then
return _parent_0[name]
else
return val
@ -864,7 +586,7 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Something = _class_0
@ -875,14 +597,10 @@ do
local _parent_0 = World
local _base_0 = { }
_base_0.__index = _base_0
if _parent_0 then
setmetatable(_base_0, _parent_0.__base)
end
setmetatable(_base_0, _parent_0.__base)
local _class_0 = setmetatable({
__init = function(self, ...)
if _parent_0 then
return _parent_0.__init(self, ...)
end
return _parent_0.__init(self, ...)
end,
__base = _base_0,
__name = "d",
@ -890,7 +608,7 @@ do
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil and _parent_0 then
if val == nil then
return _parent_0[name]
else
return val
@ -903,7 +621,7 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
d = _class_0
@ -911,30 +629,14 @@ end
print(((function()
local WhatsUp
do
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,
__init = function() end,
__base = _base_0,
__name = "WhatsUp",
__parent = _parent_0
__name = "WhatsUp"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -942,38 +644,19 @@ print(((function()
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
WhatsUp = _class_0
return _class_0
end
end)()).__name)
do
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,
__init = function() end,
__base = _base_0,
__name = "Something",
__parent = _parent_0
__name = "Something"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -983,35 +666,20 @@ do
_base_0.__class = _class_0
local self = _class_0
_ = nil
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Something = _class_0
end
do
local val, insert
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)
return print(insert, val)
end,
__base = _base_0,
__name = "Something",
__parent = _parent_0
__name = "Something"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -1025,32 +693,17 @@ do
local _obj_0 = table
insert = _obj_0.insert
end
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Something = _class_0
end
do
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 = hi,
__base = _base_0,
__name = "X",
__parent = _parent_0
__name = "X"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -1058,9 +711,6 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
X = _class_0
end
return nil

View File

@ -4,32 +4,16 @@ do
end
do
do
local _parent_0 = nil
local _base_0 = {
umm = "cool"
}
_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,
__init = function() end,
__base = _base_0,
__name = "Something",
__parent = _parent_0
__name = "Something"
}, {
__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,
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
@ -37,9 +21,6 @@ do
end
})
_base_0.__class = _class_0
if _parent_0 and _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Something = _class_0
end
end