Adding basic native enums validation

This commit is contained in:
Pavel Shevaev 2023-09-12 11:28:47 +03:00
parent 2450fd0060
commit 12470844f3
1 changed files with 6 additions and 1 deletions

View File

@ -572,7 +572,12 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
{%- for fname,v in o.values ~%}
{
en.Define(new EnumItemSymbol(new Origin(), "{{fname}}" ,(int){{v}}));
#if !BHL_FRONT
if(Enum.GetName(en.GetNativeType(), {{v}}) != "{{fname}}")
throw new Exception("Enum '{{o.name}}' names don't match at value " + {{v}});
#endif
en.Define(new EnumItemSymbol(new Origin(), "{{fname}}", (int){{v}}));
}
{%~ endfor -%}