Adding origin support
This commit is contained in:
parent
4a626df4f7
commit
0eae5ffb28
|
@ -27,7 +27,7 @@ public static void Register(Types types)
|
|||
{% block register %}
|
||||
{{ macro.call_reg_units(slice_units(meta.units, 20)) }}
|
||||
|
||||
BHL_Types.Type_GenericArray = new GenericArrayTypeSymbol(new Proxy<IType>());
|
||||
BHL_Types.Type_GenericArray = Types.Array;
|
||||
{{ macro.assign_global_types(meta.units) }}
|
||||
{% endblock %}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{%- macro reg_func_native(o, scope = 'types.ns', this_prefix = '') ~%}
|
||||
{
|
||||
var fn = new FuncSymbolNative("{{o.name|ns_last}}",
|
||||
var fn = new FuncSymbolNative(new Origin(), "{{o.name|ns_last}}",
|
||||
|
||||
{%- if has_token(o, 'bhl_coroutine') -%}
|
||||
FuncAttrib.Coro,
|
||||
|
@ -46,7 +46,7 @@
|
|||
|
||||
{%- macro reg_func_partial(o, scope = 'types.ns') ~%}
|
||||
{
|
||||
var fn = new FuncSymbolNative("{{o.name|ns_last}}",
|
||||
var fn = new FuncSymbolNative(new Origin(), "{{o.name|ns_last}}",
|
||||
{%- if has_token(o, 'bhl_coroutine') -%}
|
||||
FuncAttrib.Coro,
|
||||
{%- endif ~%}
|
||||
|
@ -138,7 +138,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
{%- macro method_partial(o, m, class_container) ~%}
|
||||
|
||||
{
|
||||
var fn = new FuncSymbolNative("{{m.name|norm_name}}",
|
||||
var fn = new FuncSymbolNative(new Origin(), "{{m.name|norm_name}}",
|
||||
FuncAttrib.None
|
||||
{% if has_token(m, 'bhl_static') ~%}
|
||||
| FuncAttrib.Static
|
||||
|
@ -173,7 +173,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
|
||||
{% if has_token(m, 'bhl_bin_op') ~%}
|
||||
{
|
||||
var fn = new FuncSymbolNative({{token(m, 'bhl_bin_op')}},
|
||||
var fn = new FuncSymbolNative(new Origin(), {{token(m, 'bhl_bin_op')}},
|
||||
FuncAttrib.Static,
|
||||
{{ m.returntype|bhl_type_ref }},
|
||||
{{ count_default_args(m) }},
|
||||
|
@ -503,12 +503,12 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
|
||||
{%- macro reg_native_arr_proxy(o, scope = 'types.ns') ~%}
|
||||
{
|
||||
var cl = new ClassSymbolNative("{{o.name}}",
|
||||
var cl = new ClassSymbolNative(new Origin(), "{{o.name}}",
|
||||
//constructor is not allowed
|
||||
null
|
||||
);
|
||||
{
|
||||
var vs = new FieldSymbol("Count", Types.Int,
|
||||
var vs = new FieldSymbol(new Origin(), "Count", Types.Int,
|
||||
delegate(VM.Frame frm, Val ctx, ref Val v, FieldSymbol fld)
|
||||
{
|
||||
#if !BHL_FRONT
|
||||
|
@ -519,7 +519,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
cl.Define(vs);
|
||||
}
|
||||
{
|
||||
var fn = new FuncSymbolNative("At", {{token(o, 'bhl_native_arr_proxy')|bhl_type_ref}},
|
||||
var fn = new FuncSymbolNative(new Origin(), "At", {{token(o, 'bhl_native_arr_proxy')|bhl_type_ref}},
|
||||
delegate(VM.Frame frm, ValStack stack, FuncArgsInfo args_info, ref BHS status)
|
||||
{
|
||||
#if !BHL_FRONT
|
||||
|
@ -549,13 +549,13 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
{%- macro reg_enum(o, scope = 'types.ns') ~%}
|
||||
|
||||
{
|
||||
var en = new EnumSymbol("{{o.name|ns_last}}");
|
||||
var en = new EnumSymbol(new Origin(), "{{o.name|ns_last}}");
|
||||
|
||||
{{scope}}.{{o.name|ns_prefix}}Define(en);
|
||||
|
||||
{%- for fname,v in o.values ~%}
|
||||
{
|
||||
en.Define(new EnumItemSymbol("{{fname}}" ,(int){{v}}));
|
||||
en.Define(new EnumItemSymbol(new Origin(), "{{fname}}" ,(int){{v}}));
|
||||
}
|
||||
{%~ endfor -%}
|
||||
|
||||
|
@ -570,7 +570,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
{% else %}
|
||||
|
||||
{
|
||||
var cl = new ClassSymbolNative("{{o.name|ns_last}}",
|
||||
var cl = new ClassSymbolNative(new Origin(), "{{o.name|ns_last}}",
|
||||
{% if o.parent %}
|
||||
types.T("{{o.parent}}"),
|
||||
{% endif %}
|
||||
|
@ -621,7 +621,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
{% set class = token_or(o, 'bhl_native_class', o.name) %}
|
||||
|
||||
{
|
||||
cl.Define(new FieldSymbol("{{f.name}}", {{f.type|bhl_type_ref}},
|
||||
cl.Define(new FieldSymbol(new Origin(), "{{f.name}}", {{f.type|bhl_type_ref}},
|
||||
{% if token_or(f, 'bhl_get', 1) != 0 ~%}
|
||||
//getter
|
||||
delegate(VM.Frame frm, Val ctx, ref Val v, FieldSymbol fld) {
|
||||
|
@ -687,7 +687,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
var ifs = new InterfaceSymbolNative("{{o.name|ns_last}}", null
|
||||
|
||||
{% for m in o.getfuncs %}
|
||||
, new FuncSymbolNative("{{m.name}}", {{m.returntype|bhl_type_ref}}, 0, null)
|
||||
, new FuncSymbolNative(new Origin(), "{{m.name}}", {{m.returntype|bhl_type_ref}}, 0, null)
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
@ -699,7 +699,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
|
||||
{%- macro reg_ecs_component(o) ~%}
|
||||
{
|
||||
var fn = new FuncSymbolNative("{{o.name}}_Ensure", Types.Void,
|
||||
var fn = new FuncSymbolNative(new Origin(), "{{o.name}}_Ensure", Types.Void,
|
||||
#if !BHL_FRONT
|
||||
delegate(VM.Frame frm, ValStack stack, FuncArgsInfo args_info, ref BHS status) {
|
||||
EcsEntity e = default;
|
||||
|
@ -719,7 +719,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
}
|
||||
|
||||
{
|
||||
var fn = new FuncSymbolNative("{{o.name}}_Del", Types.Void,
|
||||
var fn = new FuncSymbolNative(new Origin(), "{{o.name}}_Del", Types.Void,
|
||||
#if !BHL_FRONT
|
||||
delegate(VM.Frame frm, ValStack stack, FuncArgsInfo args_info, ref BHS status) {
|
||||
EcsEntity e = default;
|
||||
|
@ -739,7 +739,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
}
|
||||
|
||||
{
|
||||
var fn = new FuncSymbolNative("{{o.name}}_Exists", Types.Bool,
|
||||
var fn = new FuncSymbolNative(new Origin(), "{{o.name}}_Exists", Types.Bool,
|
||||
#if !BHL_FRONT
|
||||
delegate(VM.Frame frm, ValStack stack, FuncArgsInfo args_info, ref BHS status) {
|
||||
EcsEntity e = default;
|
||||
|
@ -770,7 +770,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
|
||||
{% if has_token(o, 'bhl_ecs_component_ref') %}
|
||||
{
|
||||
var cl = new ClassSymbolNative("{{o.name}}__Ref");
|
||||
var cl = new ClassSymbolNative(new Origin(), "{{o.name}}__Ref");
|
||||
types.ns.Define(cl);
|
||||
{% for f in o.getfields %}
|
||||
{{ _self.ecs_component_field_ref(o, f) }}
|
||||
|
@ -778,7 +778,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
cl.Setup();
|
||||
|
||||
{
|
||||
var fn = new FuncSymbolNative("{{o.name}}_Ref", {{(o.name ~ '__Ref') | bhl_type_ref}},
|
||||
var fn = new FuncSymbolNative(new Origin(), "{{o.name}}_Ref", {{(o.name ~ '__Ref') | bhl_type_ref}},
|
||||
#if !BHL_FRONT
|
||||
delegate(VM.Frame frm, ValStack stack, FuncArgsInfo args_info, ref BHS status) {
|
||||
EcsEntity e = default;
|
||||
|
@ -812,7 +812,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
|
||||
{%- macro ecs_component_field(o, f) ~%}
|
||||
{
|
||||
var fn = new FuncSymbolNative("{{o.name}}_{{f.name}}", {{f.type|bhl_type_ref}},
|
||||
var fn = new FuncSymbolNative(new Origin(), "{{o.name}}_{{f.name}}", {{f.type|bhl_type_ref}},
|
||||
{%- if token_or(f, 'bhl_set', 1) != 0 ~%}
|
||||
1,
|
||||
{%- endif ~%}
|
||||
|
@ -857,7 +857,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
|
||||
{%- macro ecs_component_func(o, m) ~%}
|
||||
{
|
||||
var fn = new FuncSymbolNative("{{o.name}}_{{m.name}}",
|
||||
var fn = new FuncSymbolNative(new Origin(), "{{o.name}}_{{m.name}}",
|
||||
{{m.returntype|bhl_type_ref}},
|
||||
{{ count_default_args(m) }},
|
||||
#if !BHL_FRONT
|
||||
|
@ -908,7 +908,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
|
||||
{%- macro ecs_component_field_ref(o, f) ~%}
|
||||
{
|
||||
cl.Define(new FieldSymbol("{{f.name}}", {{f.type|bhl_type_ref}},
|
||||
cl.Define(new FieldSymbol(new Origin(), "{{f.name}}", {{f.type|bhl_type_ref}},
|
||||
{%- if token_or(f, 'bhl_get', 1) != 0 ~%}
|
||||
//getter
|
||||
delegate(VM.Frame frm, Val ctx, ref Val v, FieldSymbol fld) {
|
||||
|
|
Loading…
Reference in New Issue