chore(Module_Info): refactor fixup
This commit is contained in:
parent
59ab75dcf0
commit
ed1763524f
src/awesomewm.d.tl/entity
|
@ -29,6 +29,33 @@ local record Module_Doc
|
||||||
populate_requires: function(Module_Doc)
|
populate_requires: function(Module_Doc)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function fixup_constructor_return_types(self: Module_Doc)
|
||||||
|
for c in self.constructors:iter() do
|
||||||
|
c:fixup()
|
||||||
|
if #c.return_types == 1 then
|
||||||
|
c.return_types[1].name = self.record_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function fixup_methods(self: Module_Doc)
|
||||||
|
for m in self.methods:iter() do
|
||||||
|
m:fixup()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function fixup_properties(self: Module_Doc)
|
||||||
|
for p in self.properties:iter() do
|
||||||
|
p:fixup()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function fixup_static_functions(self: Module_Doc)
|
||||||
|
for s in self.static_functions:iter() do
|
||||||
|
s:fixup()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local __Module_Doc: metatable<Module_Doc> = {
|
local __Module_Doc: metatable<Module_Doc> = {
|
||||||
__call = function(_: Module_Doc): Module_Doc
|
__call = function(_: Module_Doc): Module_Doc
|
||||||
return {
|
return {
|
||||||
|
@ -40,21 +67,10 @@ local __Module_Doc: metatable<Module_Doc> = {
|
||||||
requires = Map(),
|
requires = Map(),
|
||||||
|
|
||||||
fixup = function(self: Module_Doc)
|
fixup = function(self: Module_Doc)
|
||||||
for c in self.constructors:iter() do
|
fixup_constructor_return_types(self)
|
||||||
c:fixup()
|
fixup_methods(self)
|
||||||
if #c.return_types == 1 then
|
fixup_properties(self)
|
||||||
c.return_types[1].name = self.record_name
|
fixup_static_functions(self)
|
||||||
end
|
|
||||||
end
|
|
||||||
for m in self.methods:iter() do
|
|
||||||
m:fixup()
|
|
||||||
end
|
|
||||||
for p in self.properties:iter() do
|
|
||||||
p:fixup()
|
|
||||||
end
|
|
||||||
for s in self.static_functions:iter() do
|
|
||||||
s:fixup()
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
populate_requires = function(self: Module_Doc)
|
populate_requires = function(self: Module_Doc)
|
||||||
-- TODO : Move this to other Entities. Can be a little tricky because we populate a map
|
-- TODO : Move this to other Entities. Can be a little tricky because we populate a map
|
||||||
|
|
Loading…
Reference in New Issue