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 diff --git a/tpl/macro.twig b/tpl/macro.twig index f969dcb..576cfcc 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 ~%} { @@ -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 %} ));