From 73320768df80f312b747a2754f3f6f3f55ed2beb Mon Sep 17 00:00:00 2001 From: Aire-One Date: Mon, 31 Oct 2022 13:44:54 +0100 Subject: [PATCH] feat(generator): basic Object Properties render --- src/awesomewm.d.tl/generator/snippets.tl | 7 +++++++ src/awesomewm.d.tl/generator/teal_type_definitions.tl | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/awesomewm.d.tl/generator/snippets.tl b/src/awesomewm.d.tl/generator/snippets.tl index 3937aae..c82b815 100644 --- a/src/awesomewm.d.tl/generator/snippets.tl +++ b/src/awesomewm.d.tl/generator/snippets.tl @@ -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): 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 local tmpl = [[ enum $(name) diff --git a/src/awesomewm.d.tl/generator/teal_type_definitions.tl b/src/awesomewm.d.tl/generator/teal_type_definitions.tl index c96d66f..7fa2985 100644 --- a/src/awesomewm.d.tl/generator/teal_type_definitions.tl +++ b/src/awesomewm.d.tl/generator/teal_type_definitions.tl @@ -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)