mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-11 04:52:21 +02:00
Fixed assign error checking to allow '+=' operator call
This commit is contained in:
parent
c9afcf3360
commit
4c499cc498
1 changed files with 14 additions and 21 deletions
|
@ -18755,16 +18755,7 @@ 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)
|
||||||
{
|
{
|
||||||
bool hasLeftVal = false;
|
bool hasLeftVal = false;
|
||||||
|
@ -18956,8 +18947,7 @@ void BfExprEvaluator::PerformAssignment(BfAssignmentExpression* assignExpr, bool
|
||||||
rightValue = mModule->CreateValueFromExpression(assignExpr->mRight, expectedType, (BfEvalExprFlags)(BfEvalExprFlags_AllowSplat | BfEvalExprFlags_NoCast));
|
rightValue = mModule->CreateValueFromExpression(assignExpr->mRight, expectedType, (BfEvalExprFlags)(BfEvalExprFlags_AllowSplat | BfEvalExprFlags_NoCast));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
|
@ -18982,15 +18972,12 @@ void BfExprEvaluator::PerformAssignment(BfAssignmentExpression* assignExpr, bool
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformBinaryOperation(assignExpr->mLeft, assignExpr->mRight, binaryOp, assignExpr->mOpToken, flags, leftValue, rightValue);
|
PerformBinaryOperation(assignExpr->mLeft, assignExpr->mRight, binaryOp, assignExpr->mOpToken, flags, leftValue, rightValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!handled)
|
convVal = mResult;
|
||||||
{
|
mResult = BfTypedValue();
|
||||||
convVal = mResult;
|
|
||||||
mResult = BfTypedValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!convVal)
|
if (!convVal)
|
||||||
return;
|
return;
|
||||||
|
@ -19039,6 +19026,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()))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue