Codegen fixes

This commit is contained in:
Madpwnhammer 2022-12-02 19:11:48 +03:00
parent 9e45d57354
commit 29fa6022a6
1 changed files with 9 additions and 7 deletions

View File

@ -119,7 +119,7 @@
stack,
Script_{{o.name|norm_name}}.Method_{{m.name}}.ReadArgs(frm, args_info)
);
return null
return null;
}
#else
null
@ -143,7 +143,7 @@
stack,
Script_{{o.name|norm_name}}.Method_{{m.name}}.ReadArgs(frm, args_info)
);
return null
return null;
}
#else
null
@ -207,7 +207,7 @@
{% endif %}
{% endfor %}
{{ _self.read_args2natives(o, 'args.', this_type) }}
{{ _self.read_args2natives(o, 'args.', this_type, false) }}
return args;
}
{%- endmacro -%}
@ -249,8 +249,11 @@
{%- endfor ~%}
{%- endmacro -%}
{%- macro read_args2natives(o, arg_prefix, this_type = null) -%}
{%- macro read_args2natives(o, arg_prefix, this_type = null, declare_locals = true) -%}
{%- if declare_locals -%}
{{ _self.local_native_vars(o.args, arg_prefix) }}
{%- endif -%}
{# traversing args in reverse order #}
{%- set default_counter = 0 -%}
@ -349,7 +352,7 @@
for(int i=0;i<dvl.Count;++i)
{
var tdv = dvl[i];
var {{_self.val2native(type.value, 'tdv', 'tmp')}};
{{_self.val2native(type.value, 'tdv', 'tmp')|replace({'tmp = tmp' : ''})}};
{{native}}.Add(tmp);
}
{%- endif -%}
@ -378,11 +381,10 @@
{%- if type is instanceof('\\mtgUserType') -%}
{%- if type is instanceof('\\mtgMetaEnum') -%}
{{value}}.SetInt((int){{native}})
{{native}} = ({{token_or(type, 'bhl_native_class', type.name)}})((int){{value}}._num)
{%- else -%}
{%- if has_token(type, 'bhl_custom_rw') -%}
var tmp = new {{token_or(type, 'bhl_native_class', type.name)}}; {{value}}.Decode(ref tmp); {{native}} = tmp
var tmp = new {{token_or(type, 'bhl_native_class', type.name)}}(); {{value}}.Decode(ref tmp); {{native}} = tmp
{%- else -%}
{{native}} = ({{token_or(type, 'bhl_native_class', type.name)}}){{value}}._obj
{%- endif -%}