mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Fixed crash with increment/decrement error
This commit is contained in:
parent
4b64f2c14d
commit
f6ab79d2ef
1 changed files with 5 additions and 7 deletions
|
@ -18385,17 +18385,15 @@ void BfExprEvaluator::PerformUnaryOperation_OnResult(BfExpression* unaryOpExpr,
|
||||||
constValue = mModule->GetConstValue(1, ptr.mType);
|
constValue = mModule->GetConstValue(1, ptr.mType);
|
||||||
if (!constValue)
|
if (!constValue)
|
||||||
{
|
{
|
||||||
mResult = BfTypedValue();
|
|
||||||
numericFail = true;
|
numericFail = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((ptr.mType->IsIntegral()) || (ptr.mType->IsEnum()) || (ptr.mType->IsFloat()))
|
if ((ptr.mType->IsIntegral()) || (ptr.mType->IsEnum()) || (ptr.mType->IsFloat()))
|
||||||
{
|
{
|
||||||
resultValue = mModule->mBfIRBuilder->CreateAdd(origVal, constValue/*, "inc"*/);
|
resultValue = mModule->mBfIRBuilder->CreateAdd(origVal, constValue/*, "inc"*/);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mResult = BfTypedValue();
|
|
||||||
numericFail = true;
|
numericFail = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -18412,7 +18410,7 @@ void BfExprEvaluator::PerformUnaryOperation_OnResult(BfExpression* unaryOpExpr,
|
||||||
break;
|
break;
|
||||||
case BfUnaryOp_PostDecrement:
|
case BfUnaryOp_PostDecrement:
|
||||||
case BfUnaryOp_Decrement:
|
case BfUnaryOp_Decrement:
|
||||||
{
|
{
|
||||||
CheckResultForReading(mResult);
|
CheckResultForReading(mResult);
|
||||||
auto ptr = mResult;
|
auto ptr = mResult;
|
||||||
//if ((propDef == NULL) && (!mModule->CheckModifyValue(ptr, opToken)))
|
//if ((propDef == NULL) && (!mModule->CheckModifyValue(ptr, opToken)))
|
||||||
|
@ -18442,7 +18440,7 @@ void BfExprEvaluator::PerformUnaryOperation_OnResult(BfExpression* unaryOpExpr,
|
||||||
{
|
{
|
||||||
numericFail = true;
|
numericFail = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((ptr.mType->IsIntegral()) || (ptr.mType->IsEnum()))
|
if ((ptr.mType->IsIntegral()) || (ptr.mType->IsEnum()))
|
||||||
{
|
{
|
||||||
resultValue = mModule->mBfIRBuilder->CreateSub(origVal, constValue);
|
resultValue = mModule->mBfIRBuilder->CreateSub(origVal, constValue);
|
||||||
|
@ -18576,7 +18574,7 @@ void BfExprEvaluator::PerformUnaryOperation_OnResult(BfExpression* unaryOpExpr,
|
||||||
default:
|
default:
|
||||||
mModule->Fail("INTERNAL ERROR: Unhandled unary operator", unaryOpExpr);
|
mModule->Fail("INTERNAL ERROR: Unhandled unary operator", unaryOpExpr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numericFail)
|
if (numericFail)
|
||||||
{
|
{
|
||||||
|
@ -18584,7 +18582,7 @@ void BfExprEvaluator::PerformUnaryOperation_OnResult(BfExpression* unaryOpExpr,
|
||||||
{
|
{
|
||||||
BF_ASSERT(mModule->mBfIRBuilder->mIgnoreWrites);
|
BF_ASSERT(mModule->mBfIRBuilder->mIgnoreWrites);
|
||||||
}
|
}
|
||||||
else if (mResult.mType->IsInterface())
|
else if ((mResult.mType != NULL) && (mResult.mType->IsInterface()))
|
||||||
{
|
{
|
||||||
mModule->Fail(
|
mModule->Fail(
|
||||||
StrFormat("Operator '%s' cannot be used on interface '%s'. Consider rewriting using generics and use this interface as a generic constraint.",
|
StrFormat("Operator '%s' cannot be used on interface '%s'. Consider rewriting using generics and use this interface as a generic constraint.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue