Better support for interface callbacks

This commit is contained in:
Pavel Shevaev 2023-05-23 15:57:36 +03:00
parent 9d9eee1ab3
commit 4be8ded046
1 changed files with 13 additions and 7 deletions

View File

@ -1,6 +1,16 @@
{%- macro reg_func_native(o, scope = 'types.ns', this_prefix = '') ~%}
{
var fn = new FuncSymbolNative(new Origin(), "{{o.name|ns_last}}",
var fn =
{{ _self.func_native(o, this_prefix) }}
;
{{scope}}.{{o.name|ns_prefix}}Define(fn);
}
{%- endmacro -%}
{%- macro func_native(o, this_prefix = '') ~%}
new FuncSymbolNative(new Origin(), "{{o.name|ns_last}}",
{%- if has_token(o, 'bhl_coroutine') -%}
FuncAttrib.Coro,
@ -38,10 +48,7 @@
{% if o.args %},{% endif %}
{{ _self.func_decl_args(o) }}
);
{{scope}}.{{o.name|ns_prefix}}Define(fn);
}
)
{%- endmacro -%}
{%- macro reg_func_partial(o, scope = 'types.ns') ~%}
@ -698,8 +705,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
var ifs = new InterfaceSymbolNative(new Origin(), "{{o.name|ns_last}}", null
{% for m in o.getfuncs %}
, new FuncSymbolNative(new Origin(), "{{m.name}}", {{m.returntype|bhl_type_ref}}, 0, null)
, {{ _self.func_native(m, '(('~o.name~')stack.PopRelease()._obj).') }}
{% endfor %}
);