Merge pull request 'Add property:: signals (#30)' (#72) from feat/#30 into master
ci/woodpecker/push/build Pipeline was successful Details
ci/woodpecker/push/docker-build Pipeline was successful Details
ci/woodpecker/push/lint Pipeline was successful Details

Reviewed-on: #72
This commit is contained in:
Aire-One 2023-01-08 18:11:17 +01:00
commit 6ae8343b9f
1 changed files with 38 additions and 15 deletions

View File

@ -29,6 +29,39 @@ 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 function fixup_properties_signals(self: Module_Doc)
for p in self.properties:iter() do
self.signals:append("property::" .. p.name)
end
end
local __Module_Doc: metatable<Module_Doc> = {
__call = function(_: Module_Doc): Module_Doc
return {
@ -40,21 +73,11 @@ 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)
fixup_properties_signals(self)
end,
populate_requires = function(self: Module_Doc)
-- TODO : Move this to other Entities. Can be a little tricky because we populate a map