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

View File

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

View File

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

View File

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