1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-14 14:24:10 +02:00

Fixed cast issue in resolveOnly

This commit is contained in:
Brian Fiete 2020-03-10 08:27:48 -07:00
parent e9ef8ed27c
commit 1c8a2a8e44

View file

@ -9139,19 +9139,26 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
if (!castedFromValue) if (!castedFromValue)
return BfIRValue(); return BfIRValue();
BfTypedValue operatorOut;
if (ignoreWrites) if (ignoreWrites)
{
if (opMethodInstance->mReturnType == toType)
return mBfIRBuilder->GetFakeVal(); return mBfIRBuilder->GetFakeVal();
operatorOut = GetDefaultTypedValue(opMethodInstance->mReturnType);
}
else
{
BfModuleMethodInstance moduleMethodInstance = GetMethodInstance(opMethodInstance->GetOwner(), opMethodInstance->mMethodDef, BfTypeVector()); BfModuleMethodInstance moduleMethodInstance = GetMethodInstance(opMethodInstance->GetOwner(), opMethodInstance->mMethodDef, BfTypeVector());
SizedArray<BfIRValue, 1> args; SizedArray<BfIRValue, 1> args;
exprEvaluator.PushArg(castedFromValue, args); exprEvaluator.PushArg(castedFromValue, args);
auto operatorOut = exprEvaluator.CreateCall(moduleMethodInstance.mMethodInstance, mCompiler->IsSkippingExtraResolveChecks() ? BfIRValue() : moduleMethodInstance.mFunc, false, args); operatorOut = exprEvaluator.CreateCall(moduleMethodInstance.mMethodInstance, mCompiler->IsSkippingExtraResolveChecks() ? BfIRValue() : moduleMethodInstance.mFunc, false, args);
if ((operatorOut.mType != NULL) && (operatorOut.mType->IsSelf())) if ((operatorOut.mType != NULL) && (operatorOut.mType->IsSelf()))
{ {
BF_ASSERT(IsInGeneric()); BF_ASSERT(IsInGeneric());
operatorOut = GetDefaultTypedValue(opMethodSrcType); operatorOut = GetDefaultTypedValue(opMethodSrcType);
} }
}
return CastToValue(srcNode, operatorOut, toType, castFlags, resultFlags); return CastToValue(srcNode, operatorOut, toType, castFlags, resultFlags);
} }