Codegen fixes

This commit is contained in:
Madpwnhammer 2022-12-02 19:39:38 +03:00
parent 29fa6022a6
commit 6f59e5b55f
1 changed files with 13 additions and 12 deletions

View File

@ -56,11 +56,11 @@
#if !BHL_FRONT
{% if has_token(o, 'bhl_coroutine') -%}
var coro = CoroutinePool.New<Script_{{o.name|norm_name}}>(frm.vm);
coro.Init(frm, args_info);
coro.Init(frm, stack, args_info);
return coro;
{%- else -%}
{%- if o.args -%}
var args = Script_{{o.name|norm_name}}.ReadArgs(frm, args_info);
var args = Script_{{o.name|norm_name}}.ReadArgs(frm, stack, args_info);
Script_{{o.name|norm_name}}.Exec(frm, stack, args);
{%- else ~%}
Script_{{o.name|norm_name}}.Exec(frm, stack);
@ -117,7 +117,7 @@
Script_{{o.name|norm_name}}.Method_{{m.name}}.Exec(
frm,
stack,
Script_{{o.name|norm_name}}.Method_{{m.name}}.ReadArgs(frm, args_info)
Script_{{o.name|norm_name}}.Method_{{m.name}}.ReadArgs(frm, stack, args_info)
);
return null;
}
@ -141,7 +141,7 @@
Script_{{o.name|norm_name}}.Method_{{m.name}}.Exec(
frm,
stack,
Script_{{o.name|norm_name}}.Method_{{m.name}}.ReadArgs(frm, args_info)
Script_{{o.name|norm_name}}.Method_{{m.name}}.ReadArgs(frm, stack, args_info)
);
return null;
}
@ -166,9 +166,9 @@
public void Init(VM.Frame frm, ValStack stack, FuncArgsInfo args_info) {
{% if o.args or this_type ~%}
args = ReadArgs(frm, args_info);
args = ReadArgs(frm, stack, args_info);
{% endif %}
Init(frm);
Init(frm, stack);
}
public void Tick(VM.Frame frm, bhl.VM.ExecState exec, ref BHS status) {
@ -291,7 +291,7 @@
{%- if this_type ~%}
{
var dv = stack.Pop();
{{ _self.val2native(this_type, 'dv', arg_prefix ~ '.self') }};
{{ _self.val2native(this_type, 'dv', arg_prefix ~ 'self') }};
dv.Release();
}
{%- endif ~%}
@ -352,7 +352,7 @@
for(int i=0;i<dvl.Count;++i)
{
var tdv = dvl[i];
{{_self.val2native(type.value, 'tdv', 'tmp')|replace({'tmp = tmp' : ''})}};
{{('var ' ~ _self.val2native(type.value, 'tdv', 'tmp'))|replace({'tmp = tmp' : '', 'var var' : 'var'})}};
{{native}}.Add(tmp);
}
{%- endif -%}
@ -696,9 +696,8 @@
{% endfor %}
types.ns.Define(cl);
cl.Setup();
}
{
{
var fn = new FuncSymbolNative("{{o.name}}_Ref", {{(o.name ~ '__Ref') | bhl_type_ref}},
#if !BHL_FRONT
delegate(VM.Frame frm, ValStack stack, FuncArgsInfo args_info, ref BHS status) {
@ -723,7 +722,9 @@
new FuncArgSymbol("__self", types.T("ecs.Entity"))
);
types.ns.Define(fn);
}
}
{% endif %}
{%- endmacro -%}
@ -751,7 +752,7 @@
{%- if token_or(f, 'bhl_set', 1) != 0 ~%}
if(dv != null) {
{{ _self.val2native(f.type, 'v', 'dv') }};
{{ _self.val2native(f.type, 'dv', 'v') }};
cmp.{{f.name}} = v;
dv.Release();
}
@ -882,7 +883,7 @@ public partial class Script_{{u.object.name}} {
{% for m in u.object.getfuncs %}
{%- if not has_token(m, 'bhl_native_prefix') ~%}
{{ _self.func_partial_class(m, 'Method_') }}
{{ _self.func_partial_class(m, 'Method_', u.object) }}
{%- endif -%}
{% endfor %}