Major refactoring of types autogen
This commit is contained in:
parent
0eae5ffb28
commit
dde59f4ce9
|
@ -14,20 +14,27 @@ using {{imp}};
|
|||
|
||||
namespace bhl {
|
||||
|
||||
{%- for u in meta.units ~%}
|
||||
{%- if u.object is instanceof('\\mtgMetaStruct') ~%}
|
||||
static public class Types_{{u.object.name|norm_name}} {
|
||||
static public IType Value;
|
||||
}
|
||||
{%- endif ~%}
|
||||
{%- endfor ~%}
|
||||
|
||||
{% block declare %}
|
||||
#if !BHL_FRONT
|
||||
{{ macro.decl_units(meta.units) }}
|
||||
#endif
|
||||
{% endblock %}
|
||||
|
||||
static public class BHL_AutoBindings {
|
||||
static public class {{register_class}} {
|
||||
|
||||
public static void Register(Types types)
|
||||
{
|
||||
{% block register %}
|
||||
{{ macro.call_reg_units(slice_units(meta.units, 20)) }}
|
||||
|
||||
BHL_Types.Type_GenericArray = Types.Array;
|
||||
{{ macro.assign_global_types(meta.units) }}
|
||||
{% endblock %}
|
||||
}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
namespace bhl {
|
||||
|
||||
static public class BHL_Types
|
||||
{
|
||||
static public IType Type_GenericArray;
|
||||
|
||||
{%- for u in meta.units ~%}
|
||||
{%- if u.object is instanceof('\\mtgMetaStruct') ~%}
|
||||
static public IType Type_{{u.object.name|norm_name}};
|
||||
{%- endif ~%}
|
||||
{%- endfor ~%}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} //namespace bhl
|
|
@ -461,7 +461,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
{{_self.native2val(type.value, 'tmp', 'tdv')}};
|
||||
dvl.lst.Add(tdv);
|
||||
}
|
||||
{{value}}.SetObj(dvl, BHL_Types.Type_GenericArray);
|
||||
{{value}}.SetObj(dvl, Types.Array);
|
||||
{%- endif -%}
|
||||
|
||||
{%- if type is instanceof('\\mtgBuiltinType') -%}
|
||||
|
@ -493,7 +493,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
|
|||
{%- if has_token(type, 'bhl_custom_rw') -%}
|
||||
{{value}}.Encode({{native}})
|
||||
{%- else -%}
|
||||
{{value}}.SetObj({{native}}, BHL_Types.Type_{{type.name|norm_name}})
|
||||
{{value}}.SetObj({{native}}, Types_{{type.name|norm_name}}.Value)
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
@ -1046,7 +1046,7 @@ public partial class Script_{{u.object.name}} {
|
|||
throw new System.Exception("Type '{{u.object.name}}' not resolved");
|
||||
if(tmp is ClassSymbol cs)
|
||||
cs.Setup();
|
||||
BHL_Types.Type_{{u.object.name|norm_name}} = tmp;
|
||||
Types_{{u.object.name|norm_name}}.Value = tmp;
|
||||
}
|
||||
{%~ endif ~%}
|
||||
{%- endif -%}
|
||||
|
|
Loading…
Reference in New Issue