From aec19d6613ee5cc65c9eb138208b722410aec938 Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Tue, 5 Sep 2023 19:09:51 +0300 Subject: [PATCH] Adding support for native types --- tpl/macro.twig | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tpl/macro.twig b/tpl/macro.twig index 689f44f..e94e678 100644 --- a/tpl/macro.twig +++ b/tpl/macro.twig @@ -516,7 +516,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack { var cl = new ClassSymbolNative(new Origin(), "{{o.name}}", //constructor is not allowed - null + creator: null ); { var vs = new FieldSymbol(new Origin(), "Count", Types.Int, @@ -588,19 +588,19 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack new Proxy(), {% endif %} {% if o.implements -%} - new List>() { + proxy_implements: new List>() { {% for imp in o.implements %} types.T("{{imp.name}}"), {% endfor %} }, {% else %} - null, + proxy_implements: null, {% endif %} {% if has_token(o, 'bhl_no_new') ~%} //constructor is not allowed - null + creator: null {% else ~%} - delegate(VM.Frame frm, ref Val v, IType type) { + creator: delegate(VM.Frame frm, ref Val v, IType type) { #if !BHL_FRONT var o = new {{token_or(o, 'bhl_native_class', o.name)}}({{token_or(o, 'bhl_native_class_params', '')}}); @@ -614,6 +614,9 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack {% endif %} #endif } + #if !BHL_FRONT + , native_type: typeof({{token_or(o, 'bhl_native_class', o.name)}}) + #endif {% endif ~%} ); {{scope}}.{{o.name|ns_prefix}}Define(cl);