Merge remote-tracking branch 'origin/master'

This commit is contained in:
Madpwnhammer 2022-12-05 14:12:11 +03:00
commit e11e5872fa
2 changed files with 16 additions and 4 deletions

View File

@ -1 +1,11 @@
This package is used for code generation of bhl2 bindings for C# using Twig templates
Usage example:
$twig = \bhl_bind\bhl_twig();
file_put_contents('autobind.cs',
$twig->render("codegen_register.twig",
['imports' => ['UnityEngine'],
'units' => $meta->getUnits()]
)
);

View File

@ -379,6 +379,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
for(int i=0;i<dvl.Count;++i)
{
var tdv = dvl[i];
{#TODO: get rid of replace hack below#}
{{('var ' ~ _self.val2native(type.value, 'tdv', 'tmp'))|replace({'tmp = tmp' : '', 'var var' : 'var'})}};
{{native}}.Add(tmp);
}
@ -576,7 +577,8 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
delegate(VM.Frame frm, Val ctx, ref Val v, FieldSymbol fld) {
#if !BHL_FRONT
{%~ if has_token(o, 'bhl_custom_rw') ~%}
{{class}} f = new {{class}}(); ctx.Decode(ref f);
{{class}} f = new {{class}}();
ctx.Decode(ref f);
{%- else ~%}
var f = ({{class}})ctx.obj;
{%- endif ~%}
@ -599,7 +601,8 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
delegate(VM.Frame frm, ref Val ctx, Val v, FieldSymbol fld) {
#if !BHL_FRONT
{%~ if has_token(o, 'bhl_custom_rw') ~%}
{{class}} f = new {{class}}(); ctx.Decode(ref f);
{{class}} f = new {{class}}();
ctx.Decode(ref f);
{%- else ~%}
var f = ({{class}})ctx.obj;
{%- endif ~%}
@ -767,9 +770,8 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
Val dv = null;
{%- if token_or(f, 'bhl_set', 1) != 0 ~%}
if(args_info.CountArgs() > 1) {
if(args_info.CountArgs() > 1)
dv = stack.Pop();
}
{%- endif ~%}
EcsEntity e = default;