mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fixed result-of-tuple crash
This commit is contained in:
parent
3863166545
commit
407c742bf9
2 changed files with 19 additions and 8 deletions
|
@ -6429,7 +6429,6 @@ BfTypedValue BfExprEvaluator::CheckEnumCreation(BfAstNode* targetSrc, BfTypeInst
|
|||
{
|
||||
// argValue can have a value even if tuplePtr does not have a value. This can happen if we are assigning to a (void) tuple,
|
||||
// but we have a value that needs to be attempted to be casted to void
|
||||
|
||||
argValue = mModule->Cast(argValues.mResolvedArgs[tupleFieldIdx].mExpression, argValue, resolvedFieldType);
|
||||
if (tupleFieldPtr)
|
||||
{
|
||||
|
@ -11418,8 +11417,11 @@ void BfExprEvaluator::Visit(BfLambdaBindExpression* lambdaBindExpr)
|
|||
|
||||
if (capturedValue)
|
||||
{
|
||||
auto fieldPtr = mModule->mBfIRBuilder->CreateInBoundsGEP(mResult.mValue, 0, fieldInstance->mDataIdx);
|
||||
mModule->mBfIRBuilder->CreateStore(capturedValue, fieldPtr);
|
||||
if (!capturedTypedVal.mType->IsVar())
|
||||
{
|
||||
auto fieldPtr = mModule->mBfIRBuilder->CreateInBoundsGEP(mResult.mValue, 0, fieldInstance->mDataIdx);
|
||||
mModule->mBfIRBuilder->CreateStore(capturedValue, fieldPtr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -14638,9 +14640,17 @@ BfModuleMethodInstance BfExprEvaluator::GetPropertyMethodInstance(BfMethodDef* m
|
|||
auto propTypeInst = mPropTarget.mType->ToTypeInstance();
|
||||
auto rawMethodInstance = mModule->GetRawMethodInstance(propTypeInst, methodDef);
|
||||
|
||||
auto useTypeInst = mOrigPropTarget.mType->ToTypeInstance();
|
||||
auto virtualMethod = (BfMethodInstance*)useTypeInst->mVirtualMethodTable[rawMethodInstance->mVirtualTableIdx].mImplementingMethod;
|
||||
return mModule->ReferenceExternalMethodInstance(virtualMethod);
|
||||
BF_ASSERT(rawMethodInstance->mVirtualTableIdx != -1);
|
||||
if (rawMethodInstance->mVirtualTableIdx == -1)
|
||||
{
|
||||
mModule->Fail(StrFormat("Failed to devirtualize %s", mModule->MethodToString(rawMethodInstance).c_str()));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto useTypeInst = mOrigPropTarget.mType->ToTypeInstance();
|
||||
auto virtualMethod = (BfMethodInstance*)useTypeInst->mVirtualMethodTable[rawMethodInstance->mVirtualTableIdx].mImplementingMethod;
|
||||
return mModule->ReferenceExternalMethodInstance(virtualMethod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10224,6 +10224,7 @@ BfTypedValue BfModule::Cast(BfAstNode* srcNode, const BfTypedValue& typedVal, Bf
|
|||
if (!castedElementVal)
|
||||
return BfTypedValue();
|
||||
auto fieldRef = mBfIRBuilder->CreateInBoundsGEP(curTupleValue, 0, toFieldInstance->mDataIdx);
|
||||
castedElementVal = LoadValue(castedElementVal);
|
||||
mBfIRBuilder->CreateStore(castedElementVal.mValue, fieldRef);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue