Adding support for @bhl_static and better support for @bhl_bin_op

This commit is contained in:
Pavel Shevaev 2022-12-09 17:14:45 +03:00
parent 361635b56b
commit 98e992ac6b
2 changed files with 9 additions and 4 deletions

View File

@ -29,6 +29,7 @@ function supported_tokens()
'bhl_ecs_component',
'bhl_ecs_component_ref',
'bhl_coroutine',
'bhl_static',
'bhl_async',
'bhl_native_class',
'bhl_native_class_params',

View File

@ -139,6 +139,9 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
{
var fn = new FuncSymbolNative("{{m.name|norm_name}}",
{% if has_token(m, 'bhl_static') ~%}
FuncAttrib.Static,
{% endif ~%}
{{ m.returntype|bhl_type_ref }},
{{ count_default_args(m) }},
#if !BHL_FRONT
@ -158,9 +161,10 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
{{class_container}}.Define(fn);
}
{%if has_token(m, 'bhl_bin_op') ~%}
{% if has_token(m, 'bhl_bin_op') ~%}
{
var fn = new FuncSymbolNative({{token(m, 'bhl_bin_op')}},
FuncAttrib.Static,
{{ m.returntype|bhl_type_ref }},
{{ count_default_args(m) }},
#if !BHL_FRONT
@ -179,7 +183,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
{{ _self.func_decl_args(m) }}
);
{{class_container}}.OverloadBinaryOperator(fn);
{{class_container}}.Define(fn);
}
{% endif ~%}
@ -213,7 +217,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
{%- macro Args(o, this_type) ~%}
public struct Args {
{% if this_type ~%}
{% if this_type and not has_token(o, 'bhl_static') ~%}
public {{this_type|native_type}} self;
{% endif %}
{% for arg in o.args ~%}
@ -315,7 +319,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
{%- endif ~%}
{%- endfor ~%}
{%- if this_type ~%}
{%- if this_type and not has_token(o, 'bhl_static') ~%}
{
var dv = stack.Pop();
{{ _self.val2native(this_type, 'dv', arg_prefix ~ 'self') }};