A bit minimizing codegen output for types setup
Publish PHP Package / docker (push) Successful in 6s
Details
Publish PHP Package / docker (push) Successful in 6s
Details
This commit is contained in:
parent
eb85f63437
commit
b96b3996ba
|
@ -956,18 +956,7 @@ public partial class Script_{{u.object.name}} {
|
|||
//assign global static types
|
||||
{%- for u in units -%}
|
||||
{%- if u.object is instanceof('\\mtgMetaStruct') or u.object is instanceof('\\mtgMetaInterface') ~%}
|
||||
{
|
||||
var tmp = types.T("{{u.object.name}}").Get();
|
||||
if(tmp == null)
|
||||
throw new System.Exception("Type '{{u.object.name}}' not resolved");
|
||||
{%- if u.object is instanceof('\\mtgMetaStruct') ~%}
|
||||
(tmp as ClassSymbolNative)?.Setup();
|
||||
{%- endif ~%}
|
||||
{%- if u.object is instanceof('\\mtgMetaInterface') ~%}
|
||||
(tmp as InterfaceSymbolNative)?.Setup();
|
||||
{%- endif ~%}
|
||||
Types_{{u.object.name|norm_name}}.Value = tmp;
|
||||
}
|
||||
Types_{{u.object.name|norm_name}}.Value = SetupType(types, "{{u.object.name}}");
|
||||
{%- endif -%}
|
||||
|
||||
{%- endfor -%}
|
||||
|
|
|
@ -45,6 +45,20 @@ public static void RegisterBegin(Types types)
|
|||
{%~ endfor -%}
|
||||
}
|
||||
|
||||
static IType SetupType(Types types, string name)
|
||||
{
|
||||
var tmp = types.T(name).Get();
|
||||
if(tmp == null)
|
||||
throw new System.Exception("Type '" + name + "' not resolved");
|
||||
|
||||
if(tmp is ClassSymbolNative csn)
|
||||
csn.Setup();
|
||||
else if(tmp is InterfaceSymbolNative isn)
|
||||
isn.Setup();
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public static void RegisterEnd(Types types)
|
||||
{
|
||||
{{ macro.setup_global_types(meta.units) }}
|
||||
|
|
Loading…
Reference in New Issue