Adding @bhl_coroutine support for methods

This commit is contained in:
Pavel Shevaev 2023-03-31 11:44:46 +03:00
parent 4311f8cf0c
commit 4837f5a282
1 changed files with 11 additions and 1 deletions

View File

@ -139,17 +139,27 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
{
var fn = new FuncSymbolNative("{{m.name|norm_name}}",
FuncAttrib.None
{% if has_token(m, 'bhl_static') ~%}
FuncAttrib.Static,
| FuncAttrib.Static
{% endif ~%}
{%- if has_token(m, 'bhl_coroutine') -%}
| FuncAttrib.Coro
{%- endif ~%},
{{ m.returntype|bhl_type_ref }},
{{ count_default_args(m) }},
#if !BHL_FRONT
delegate(VM.Frame frm, ValStack stack, FuncArgsInfo args_info, ref BHS status) {
{% if has_token(m, 'bhl_coroutine') -%}
var coro = CoroutinePool.New<Script_{{o.name|norm_name}}.Method_{{m.name|norm_name}}>(frm.vm);
coro.Init(frm, stack, args_info);
return coro;
{%- else ~%}
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;
{%- endif ~%}
}
#else
null