Const Enums From / to ordinal using casts is back. Add "--use-old-enums", deprecating lookup.

This commit is contained in:
Christoffer Lerno
2025-06-27 01:48:21 +02:00
committed by Christoffer Lerno
parent 4a803ed0cf
commit 13bb2b6690
92 changed files with 1716 additions and 438 deletions

View File

@@ -44,6 +44,7 @@ fn uint128? int_from_any(any arg, bool *is_neg) @private
*is_neg = false;
return (uint128)(uptr)*(void**)arg.ptr;
case DISTINCT:
case CONST_ENUM:
return int_from_any(arg.as_inner(), is_neg);
default:
break;
@@ -94,7 +95,7 @@ fn FloatType? float_from_any(any arg) @private
$if env::F128_SUPPORT:
if (arg.type == float128.typeid) return (FloatType)*((float128*)arg.ptr);
$endif
if (arg.type.kindof == TypeKind.DISTINCT)
if (arg.type.kindof == DISTINCT || arg.type.kindof == CONST_ENUM)
{
return float_from_any(arg.as_inner());
}