From 1c4a827b0a0c06571b03799ba7d77b01f6f9a9b5 Mon Sep 17 00:00:00 2001 From: wrenge Date: Mon, 15 Jan 2024 13:17:19 +0300 Subject: [PATCH] Add support for list ref --- tpl/bhl_bind_macro.twig | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tpl/bhl_bind_macro.twig b/tpl/bhl_bind_macro.twig index 7042489..1479947 100644 --- a/tpl/bhl_bind_macro.twig +++ b/tpl/bhl_bind_macro.twig @@ -560,6 +560,28 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack ); cl.Define(fn); } + { + var fn = new FuncSymbolNative(new Origin(), "Add", Types.Void, + delegate(VM.Frame frm, ValStack stack, FuncArgsInfo args_info, ref BHS status) + { +#if !BHL_FRONT + var val = stack.Pop(); + var val_lst = stack.Pop(); + + {#TODO: get rid of replace hack below#} + {{('var ' ~ _self.val2native(token(o, 'bhl_native_arr_proxy'), 'val', 'tmp'))|replace({'tmp = tmp' : '', 'var var' : 'var'})}}; + var lst = ((List<{{token(o, 'bhl_native_arr_proxy')|native_type}}>)val_lst.obj); + lst.Add(tmp); + + val.Release(); + val_lst.Release(); +#endif + return null; + }, + new FuncArgSymbol("v", {{token(o, 'bhl_native_arr_proxy')|bhl_type_ref}}) + ); + cl.Define(fn); + } cl.Setup(); {{scope}}.Define(cl); }