Added out return vals codegen
This commit is contained in:
parent
0703646984
commit
0e31e81c1d
|
@ -61,10 +61,11 @@
|
|||
{%- else -%}
|
||||
{%- if o.args -%}
|
||||
var args = Script_{{o.name|norm_name}}.ReadArgs(frm, stack, args_info);
|
||||
Script_{{o.name|norm_name}}.Exec(frm, stack, args);
|
||||
Script_{{o.name|norm_name}}.Exec(frm, args {{_self.out_results(o)}});
|
||||
{%- else ~%}
|
||||
Script_{{o.name|norm_name}}.Exec(frm, stack);
|
||||
Script_{{o.name|norm_name}}.Exec(frm {{_self.out_results(o)}});
|
||||
{%- endif ~%}
|
||||
{{_self.return_out_results(o)}}
|
||||
return null;
|
||||
{%- endif ~%}
|
||||
#else
|
||||
|
@ -78,6 +79,34 @@
|
|||
}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro out_results(o) -%}
|
||||
{%- if o.returntype -%}
|
||||
{%- for idx, type_item in types_array(o.returntype) -%}
|
||||
, out {{type_item|native_type}} result{{idx}}
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro return_out_results(o) -%}
|
||||
{%- if o.returntype -%}
|
||||
Script_{{o.name|norm_name}}.ReturnValue(frm, stack
|
||||
{%- for idx, type_item in types_array(o.returntype) -%}
|
||||
, result{{idx}}
|
||||
{%- endfor -%}
|
||||
);
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro return_method_out_results(o, m) -%}
|
||||
{%- if m.returntype -%}
|
||||
Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
||||
{%- for idx, type_item in types_array(m.returntype) -%}
|
||||
, result{{idx}}
|
||||
{%- endfor -%}
|
||||
);
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro func_partial_class(o, prefix, this_type = null) ~%}
|
||||
|
||||
public partial class {{prefix}}{{o.name|norm_name}} {% if has_token(o, 'bhl_coroutine') %}: bhl.ICoroutine {% endif %} {
|
||||
|
@ -114,11 +143,9 @@
|
|||
{{ count_default_args(m) }},
|
||||
#if !BHL_FRONT
|
||||
delegate(VM.Frame frm, ValStack stack, FuncArgsInfo args_info, ref BHS status) {
|
||||
Script_{{o.name|norm_name}}.Method_{{m.name}}.Exec(
|
||||
frm,
|
||||
stack,
|
||||
Script_{{o.name|norm_name}}.Method_{{m.name}}.ReadArgs(frm, stack, args_info)
|
||||
);
|
||||
var args = Script_{{o.name|norm_name}}.Method_{{m.name}}.ReadArgs(frm, stack, args_info);
|
||||
Script_{{o.name|norm_name}}.Method_{{m.name}}.Exec(frm, args {{_self.out_results(m)}});
|
||||
{{_self.return_method_out_results(o, m)}}
|
||||
return null;
|
||||
}
|
||||
#else
|
||||
|
@ -138,11 +165,11 @@
|
|||
{{ count_default_args(m) }},
|
||||
#if !BHL_FRONT
|
||||
delegate(VM.Frame frm, ValStack stack, FuncArgsInfo args_info, ref BHS status) {
|
||||
Script_{{o.name|norm_name}}.Method_{{m.name}}.Exec(
|
||||
frm,
|
||||
stack,
|
||||
Script_{{o.name|norm_name}}.Method_{{m.name}}.ReadArgs(frm, stack, args_info)
|
||||
);
|
||||
|
||||
var args = Script_{{o.name|norm_name}}.Method_{{m.name}}.ReadArgs(frm, stack, args_info);
|
||||
Script_{{o.name|norm_name}}.Method_{{m.name}}.Exec(frm, args {{_self.out_results(m)}});
|
||||
{{_self.return_method_out_results(o, m)}}
|
||||
|
||||
return null;
|
||||
}
|
||||
#else
|
||||
|
@ -214,11 +241,11 @@
|
|||
|
||||
{%- macro ReturnValue(o) -%}
|
||||
{%if o.returntype == 'any' %}
|
||||
static void ReturnValue(VM.Frame frm, ValStack stack, bhl.Val dv) {
|
||||
static public void ReturnValue(VM.Frame frm, ValStack stack, bhl.Val dv) {
|
||||
stack.Push(dv);
|
||||
}
|
||||
{% else ~%}
|
||||
static void ReturnValue(VM.Frame frm, ValStack stack,
|
||||
static public void ReturnValue(VM.Frame frm, ValStack stack,
|
||||
{%- for idx, type_item in types_array(o.returntype) -%}
|
||||
{{type_item|native_type}} v{{idx}}{% if not loop.last %},{% endif %}
|
||||
{%- endfor -%}
|
||||
|
|
Loading…
Reference in New Issue