Methods connect_signal and emit_signal should use the Signal enum to type the name property (#63) #66

Merged
Aire-One merged 1 commits from feat/#63 into master 2022-12-30 18:12:45 +01:00
1 changed files with 33 additions and 6 deletions

View File

@ -22,6 +22,36 @@ local record Function_Info
fixup: function(Function_Info)
end
local function fixup_parameters(self: Function_Info)
for p in self.parameters:iter() do
p:fixup()
end
end
local function fixup_return_types(self: Function_Info)
for r in self.return_types:iter() do
r:fixup()
end
end
local function fixup_signal_type(self: Function_Info)
if List {
"connect_signal",
"weak_connect_signal",
"disconnect_signal",
"emit_signal",
"emit_signal_recursive",
}:contains(self.name) then
if self.parameters[1].name == "self" then
-- Instance level method
self.parameters[2].types[1].name = "Signal"
else
-- Static function
self.parameters[1].types[1].name = "Signal"
end
end
end
local __Function_Info: metatable<Function_Info> = {
__call = function(
_self: Function_Info,
@ -34,12 +64,9 @@ local __Function_Info: metatable<Function_Info> = {
return_types = return_types or (List() as List<Type_Info.Type_Info>),
fixup = function(self: Function_Info)
for p in self.parameters:iter() do
p:fixup()
end
for r in self.return_types:iter() do
r:fixup()
end
fixup_parameters(self)
fixup_return_types(self)
fixup_signal_type(self)
end,
}
end,