feat(generator): basic Object Properties render
ci/woodpecker/pr/lint Pipeline was successful Details
ci/woodpecker/pr/build Pipeline was successful Details

This commit is contained in:
Aire-One 2022-10-31 13:44:54 +01:00
parent 1fa62b7955
commit 73320768df
2 changed files with 12 additions and 0 deletions

View File

@ -3,6 +3,7 @@ local List = require "pl.List"
local stringx = require "pl.stringx"
local template = require "pl.template"
local utils = require "utils"
local Variable_Info = require "entity.Variable_Info"
local snippets = {}
@ -44,6 +45,12 @@ function snippets.render_record_functions(items: List<Function_Info.Function_Inf
end):concat("\n")
end
function snippets.render_record_properties(items: List<Variable_Info.Variable_Info>): string
return items:map(function(item: Variable_Info.Variable_Info): string
return snippets.render_typed_variable(item.name, item.types)
end):concat("\n")
end
function snippets.render_enum(name: string, values: List<string>): string
local tmpl = [[
enum $(name)

View File

@ -16,7 +16,12 @@ $(snippets.indent(snippets.render_enum("Signal", module.signals)))
# if #module.methods then
-- Object methods
$(snippets.indent(snippets.render_record_functions(module.methods)))
# end -- /methods
# if #module.properties then
-- Object properties
$(snippets.indent(snippets.render_record_properties(module.properties)))
# end -- /properties
end
return $(module.record_name)