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

Concrete type size fix

This commit is contained in:
Brian Fiete 2021-01-22 05:52:49 -08:00
parent 9ccdf7282e
commit 9df5442a37
2 changed files with 12 additions and 12 deletions

View file

@ -21643,17 +21643,13 @@ void BfExprEvaluator::PerformBinaryOperation(BfType* resultType, BfIRValue convL
case BfBinaryOp_StrictEquality: case BfBinaryOp_StrictEquality:
mResult = BfTypedValue(mModule->mBfIRBuilder->CreateConst(BfTypeCode_Boolean, 1), mResult = BfTypedValue(mModule->mBfIRBuilder->CreateConst(BfTypeCode_Boolean, 1),
mModule->GetPrimitiveType(BfTypeCode_Boolean)); mModule->GetPrimitiveType(BfTypeCode_Boolean));
break; return;
case BfBinaryOp_InEquality: case BfBinaryOp_InEquality:
case BfBinaryOp_StrictInEquality: case BfBinaryOp_StrictInEquality:
mResult = BfTypedValue(mModule->mBfIRBuilder->CreateConst(BfTypeCode_Boolean, 0), mResult = BfTypedValue(mModule->mBfIRBuilder->CreateConst(BfTypeCode_Boolean, 0),
mModule->GetPrimitiveType(BfTypeCode_Boolean)); mModule->GetPrimitiveType(BfTypeCode_Boolean));
break; return;
default: }
mModule->Fail("Invalid operation for void", opToken);
break;
}
return;
} }
if ((!convLeftValue) || (!convRightValue)) if ((!convLeftValue) || (!convRightValue))

View file

@ -1284,8 +1284,8 @@ void BfModule::PopulateType(BfType* resolvedTypeRef, BfPopulateType populateType
{ {
BfConcreteInterfaceType* concreteInterfaceType = (BfConcreteInterfaceType*)resolvedTypeRef; BfConcreteInterfaceType* concreteInterfaceType = (BfConcreteInterfaceType*)resolvedTypeRef;
BF_ASSERT(concreteInterfaceType->mInterface->IsInterface()); BF_ASSERT(concreteInterfaceType->mInterface->IsInterface());
resolvedTypeRef->mSize = concreteInterfaceType->mInterface->mSize; resolvedTypeRef->mSize = mContext->mBfObjectType->mSize;
resolvedTypeRef->mAlign = concreteInterfaceType->mInterface->mAlign; resolvedTypeRef->mAlign = mContext->mBfObjectType->mAlign;
resolvedTypeRef->mDefineState = BfTypeDefineState_Defined; resolvedTypeRef->mDefineState = BfTypeDefineState_Defined;
return; return;
} }
@ -11850,17 +11850,21 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
auto castedFromValue = Cast(srcNode, typedVal, bestFromType, castFlags); auto castedFromValue = Cast(srcNode, typedVal, bestFromType, castFlags);
if (!castedFromValue) if (!castedFromValue)
return BfIRValue(); return BfIRValue();
BfTypedValue operatorOut; BfTypedValue operatorOut;
if (ignoreWrites) if (ignoreWrites)
{ {
if (opMethodInstance != NULL)
exprEvaluator.PerformCallChecks(opMethodInstance, srcNode);
if (returnType == toType) if (returnType == toType)
return mBfIRBuilder->GetFakeVal(); return mBfIRBuilder->GetFakeVal();
operatorOut = GetDefaultTypedValue(returnType); operatorOut = GetDefaultTypedValue(returnType);
} }
else else
{ {
BfModuleMethodInstance moduleMethodInstance = GetMethodInstance(opMethodInstance->GetOwner(), opMethodInstance->mMethodDef, BfTypeVector()); BfModuleMethodInstance moduleMethodInstance = GetMethodInstance(opMethodInstance->GetOwner(), opMethodInstance->mMethodDef, BfTypeVector());
exprEvaluator.PerformCallChecks(moduleMethodInstance.mMethodInstance, srcNode);
SizedArray<BfIRValue, 1> args; SizedArray<BfIRValue, 1> args;
exprEvaluator.PushArg(castedFromValue, args); exprEvaluator.PushArg(castedFromValue, args);