mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Fixed cast issue in resolveOnly
This commit is contained in:
parent
e9ef8ed27c
commit
1c8a2a8e44
1 changed files with 17 additions and 10 deletions
|
@ -9139,18 +9139,25 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
|
||||||
if (!castedFromValue)
|
if (!castedFromValue)
|
||||||
return BfIRValue();
|
return BfIRValue();
|
||||||
|
|
||||||
|
BfTypedValue operatorOut;
|
||||||
if (ignoreWrites)
|
if (ignoreWrites)
|
||||||
return mBfIRBuilder->GetFakeVal();
|
|
||||||
|
|
||||||
BfModuleMethodInstance moduleMethodInstance = GetMethodInstance(opMethodInstance->GetOwner(), opMethodInstance->mMethodDef, BfTypeVector());
|
|
||||||
|
|
||||||
SizedArray<BfIRValue, 1> args;
|
|
||||||
exprEvaluator.PushArg(castedFromValue, args);
|
|
||||||
auto operatorOut = exprEvaluator.CreateCall(moduleMethodInstance.mMethodInstance, mCompiler->IsSkippingExtraResolveChecks() ? BfIRValue() : moduleMethodInstance.mFunc, false, args);
|
|
||||||
if ((operatorOut.mType != NULL) && (operatorOut.mType->IsSelf()))
|
|
||||||
{
|
{
|
||||||
BF_ASSERT(IsInGeneric());
|
if (opMethodInstance->mReturnType == toType)
|
||||||
operatorOut = GetDefaultTypedValue(opMethodSrcType);
|
return mBfIRBuilder->GetFakeVal();
|
||||||
|
operatorOut = GetDefaultTypedValue(opMethodInstance->mReturnType);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BfModuleMethodInstance moduleMethodInstance = GetMethodInstance(opMethodInstance->GetOwner(), opMethodInstance->mMethodDef, BfTypeVector());
|
||||||
|
|
||||||
|
SizedArray<BfIRValue, 1> args;
|
||||||
|
exprEvaluator.PushArg(castedFromValue, args);
|
||||||
|
operatorOut = exprEvaluator.CreateCall(moduleMethodInstance.mMethodInstance, mCompiler->IsSkippingExtraResolveChecks() ? BfIRValue() : moduleMethodInstance.mFunc, false, args);
|
||||||
|
if ((operatorOut.mType != NULL) && (operatorOut.mType->IsSelf()))
|
||||||
|
{
|
||||||
|
BF_ASSERT(IsInGeneric());
|
||||||
|
operatorOut = GetDefaultTypedValue(opMethodSrcType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CastToValue(srcNode, operatorOut, toType, castFlags, resultFlags);
|
return CastToValue(srcNode, operatorOut, toType, castFlags, resultFlags);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue