Small safety checking

This commit is contained in:
Ne_Eo
2024-09-01 03:32:17 +02:00
parent abb4cd3427
commit 67e9e8e22d
@@ -95,6 +95,21 @@ class FlagMacro {
}
}
var didFind = false;
for(v in values) {
switch(expr.expr) {
case EConst(CString(s, kind)):
if(v == s)
didFind = true;
case EConst(CInt(num)):
if(v == num)
didFind = true;
default:
}
}
if(!didFind)
Context.error("Flags Allow<> must have a default value that is allowed, " + expr.toString() + " is not allowed", field.pos);
if(chosenType == NONE)
Context.error("Flags Allow<> must have a type", field.pos);