From f8647ffbdfbfaefb3d490fcb8ad4f00e6d65dad4 Mon Sep 17 00:00:00 2001 From: madpwnhammer Date: Sat, 3 Dec 2022 15:52:02 +0300 Subject: [PATCH 1/3] Fix macro ecs_component_field_ref --- tpl/macro.twig | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tpl/macro.twig b/tpl/macro.twig index e176537..b5f4498 100644 --- a/tpl/macro.twig +++ b/tpl/macro.twig @@ -829,8 +829,8 @@ {%- macro ecs_component_field_ref(o, f) ~%} { cl.Define(new FieldSymbol("{{f.name}}", {{f.type|bhl_type_ref}}, - //getter {%- if token_or(f, 'bhl_get', 1) != 0 ~%} + //getter delegate(VM.Frame frm, Val ctx, ref Val v, FieldSymbol fld) { #if !BHL_FRONT @@ -840,13 +840,15 @@ {{ _self.native2val(f.type, 'f.' ~ f.name, 'v') }}; #endif - }, + } {% else %} - null, + //getter not allowed + null {% endif %} - - //setter + , + {%- if token_or(f, 'bhl_set', 1) != 0 ~%} + //setter delegate(VM.Frame frm, ref Val ctx, Val v, FieldSymbol fld) { #if !BHL_FRONT @@ -858,7 +860,8 @@ #endif } {% else %} - null, + //setter not allowed + null {% endif %} )); From 39f075cb05db5facad23fba631d941c3fe69cbdb Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Sat, 3 Dec 2022 17:18:25 +0300 Subject: [PATCH 2/3] Adding README and ignores file --- .gitignore | 1 + README.md | 1 + 2 files changed, 2 insertions(+) create mode 100644 .gitignore create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6e92f57 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tags diff --git a/README.md b/README.md new file mode 100644 index 0000000..c5bfec3 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +This package is used for code generation of bhl2 bindings for C# using Twig templates From ae7b0f5e0c58ac18e438271d7d7cec7bd9d469cc Mon Sep 17 00:00:00 2001 From: madpwnhammer Date: Sun, 4 Dec 2022 13:15:14 +0300 Subject: [PATCH 3/3] Fixed readargs macro --- tpl/macro.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tpl/macro.twig b/tpl/macro.twig index b5f4498..1491fcc 100644 --- a/tpl/macro.twig +++ b/tpl/macro.twig @@ -265,7 +265,7 @@ {{Error("ref argument is not allowed to have a default value: " ~ o.name ~ '.' ~ arg.name)}} {%- endif ~%} - {%- do ++default_counter -%} + {%- set default_counter = default_counter + 1 -%} if(!args_info.IsDefaultArgUsed({{o.args|length - count_required_args(o) - default_counter}})) {%- endif ~%} {