1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-12 21:34:11 +02:00

Fixed assign error checking to allow '+=' operator call

This commit is contained in:
Brian Fiete 2022-02-16 07:18:04 -05:00
parent c9afcf3360
commit 4c499cc498

View file

@ -18755,15 +18755,6 @@ void BfExprEvaluator::PerformAssignment(BfAssignmentExpression* assignExpr, bool
ResolveGenericType(); ResolveGenericType();
auto ptr = mResult; auto ptr = mResult;
mResult = BfTypedValue(); mResult = BfTypedValue();
if (mPropDef == NULL)
{
if (!CheckModifyResult(ptr, assignExpr->mOpToken, "assign to", false, false, true))
{
if (assignExpr->mRight != NULL)
mModule->CreateValueFromExpression(assignExpr->mRight, ptr.mType, BfEvalExprFlags_NoCast);
return;
}
}
if (mPropDef != NULL) if (mPropDef != NULL)
{ {
@ -18957,7 +18948,6 @@ void BfExprEvaluator::PerformAssignment(BfAssignmentExpression* assignExpr, bool
} }
} }
bool handled = false;
BfResolvedArgs argValues; BfResolvedArgs argValues;
if ((rightValue) || (deferBinop)) if ((rightValue) || (deferBinop))
@ -18966,8 +18956,8 @@ void BfExprEvaluator::PerformAssignment(BfAssignmentExpression* assignExpr, bool
auto opResult = PerformAssignment_CheckOp(assignExpr, deferBinop, leftValue, rightValue, evaluatedRight); auto opResult = PerformAssignment_CheckOp(assignExpr, deferBinop, leftValue, rightValue, evaluatedRight);
if (opResult) if (opResult)
{ {
handled = true; mResult = opResult;
convVal = opResult; return;
} }
else else
{ {
@ -18986,11 +18976,8 @@ void BfExprEvaluator::PerformAssignment(BfAssignmentExpression* assignExpr, bool
} }
} }
if (!handled)
{
convVal = mResult; convVal = mResult;
mResult = BfTypedValue(); mResult = BfTypedValue();
}
if (!convVal) if (!convVal)
return; return;
@ -19040,6 +19027,12 @@ void BfExprEvaluator::PerformAssignment(BfAssignmentExpression* assignExpr, bool
} }
} }
if (!CheckModifyResult(ptr, assignExpr->mOpToken, "assign to", false, false, true))
{
mResult = convVal;
return;
}
BF_ASSERT(convVal); BF_ASSERT(convVal);
if ((convVal) && (convVal.mType->IsNull()) && (ptr.mType->IsNullable())) if ((convVal) && (convVal.mType->IsNull()) && (ptr.mType->IsNullable()))
{ {