chore(Module_Info): refactor fixup
This commit is contained in:
parent
59ab75dcf0
commit
ed1763524f
|
@ -29,6 +29,33 @@ local record Module_Doc
|
|||
populate_requires: function(Module_Doc)
|
||||
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> = {
|
||||
__call = function(_: Module_Doc): Module_Doc
|
||||
return {
|
||||
|
@ -40,21 +67,10 @@ local __Module_Doc: metatable<Module_Doc> = {
|
|||
requires = Map(),
|
||||
|
||||
fixup = function(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
|
||||
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
|
||||
fixup_constructor_return_types(self)
|
||||
fixup_methods(self)
|
||||
fixup_properties(self)
|
||||
fixup_static_functions(self)
|
||||
end,
|
||||
populate_requires = function(self: Module_Doc)
|
||||
-- TODO : Move this to other Entities. Can be a little tricky because we populate a map
|
||||
|
|
Loading…
Reference in New Issue