1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Allow 'public static int operator implicit(Self self);'

This commit is contained in:
Brian Fiete 2025-02-15 10:38:48 -08:00
parent fa251b3439
commit 94944082eb
3 changed files with 23 additions and 0 deletions

View file

@ -14672,6 +14672,11 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
{
typedVal = LoadValue(typedVal);
auto convTypedValue = BfTypedValue(typedVal.mValue, fromType->GetUnderlyingType());
if ((fromType->IsEnum()) && (convTypedValue.mType->IsVoid()) && (methodMatcher.mBestRawMethodInstance != NULL))
{
if (methodMatcher.mBestRawMethodInstance)
convTypedValue = GetDefaultTypedValue(methodMatcher.mBestRawMethodInstance->mReturnType);
}
return CastToValue(srcNode, convTypedValue, toType, (BfCastFlags)(castFlags & ~BfCastFlags_Explicit), NULL);
}
else if (toType->IsTypedPrimitive())