Adding support for native types

This commit is contained in:
Pavel Shevaev 2023-09-05 19:09:51 +03:00
parent 1b9b73a102
commit aec19d6613
1 changed files with 8 additions and 5 deletions

View File

@ -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<IType>(),
{% endif %}
{% if o.implements -%}
new List<Proxy<IType>>() {
proxy_implements: new List<Proxy<IType>>() {
{% 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);