mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Fixed 'vec += .(1, 2)' case
This commit is contained in:
parent
9b55146064
commit
94c2b980fe
2 changed files with 15 additions and 8 deletions
|
@ -23981,8 +23981,6 @@ void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNod
|
|||
argValues.Init(&sizedArgExprs);
|
||||
ResolveArgValues(argValues, BfResolveArgsFlag_DeferParamEval);
|
||||
rightArg = argValues.mResolvedArgs[0];
|
||||
if (!rightArg.mTypedValue)
|
||||
continue;
|
||||
}
|
||||
|
||||
SizedArray<BfResolvedArg, 2> args;
|
||||
|
@ -24253,8 +24251,8 @@ void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNod
|
|||
bool works = false;
|
||||
if (opConstraint.mBinaryOp == findBinaryOp)
|
||||
{
|
||||
if ((mModule->CanCast(args[0].mTypedValue, opConstraint.mLeftType)) &&
|
||||
(mModule->CanCast(args[1].mTypedValue, opConstraint.mRightType)))
|
||||
if (((args[0].mTypedValue) && (mModule->CanCast(args[0].mTypedValue, opConstraint.mLeftType))) &&
|
||||
((args[1].mTypedValue) && (mModule->CanCast(args[1].mTypedValue, opConstraint.mRightType))))
|
||||
{
|
||||
works = true;
|
||||
}
|
||||
|
@ -24262,13 +24260,13 @@ void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNod
|
|||
|
||||
if ((isComparison) && (opConstraint.mBinaryOp == BfBinaryOp_Compare))
|
||||
{
|
||||
if ((mModule->CanCast(args[0].mTypedValue, opConstraint.mLeftType)) &&
|
||||
(mModule->CanCast(args[1].mTypedValue, opConstraint.mRightType)))
|
||||
if (((args[0].mTypedValue) && (mModule->CanCast(args[0].mTypedValue, opConstraint.mLeftType))) &&
|
||||
((args[1].mTypedValue) && (mModule->CanCast(args[1].mTypedValue, opConstraint.mRightType))))
|
||||
{
|
||||
works = true;
|
||||
}
|
||||
else if ((mModule->CanCast(args[0].mTypedValue, opConstraint.mRightType)) &&
|
||||
(mModule->CanCast(args[1].mTypedValue, opConstraint.mLeftType)))
|
||||
else if (((args[0].mTypedValue) && (mModule->CanCast(args[0].mTypedValue, opConstraint.mRightType))) &&
|
||||
((args[1].mTypedValue) && (mModule->CanCast(args[1].mTypedValue, opConstraint.mLeftType))))
|
||||
{
|
||||
works = true;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,11 @@ namespace Tests
|
|||
{
|
||||
public int mA;
|
||||
|
||||
public this(int a)
|
||||
{
|
||||
mA = a;
|
||||
}
|
||||
|
||||
public static StructA operator+(StructA lhs, StructA rhs)
|
||||
{
|
||||
StructA res;
|
||||
|
@ -557,6 +562,10 @@ namespace Tests
|
|||
Test.Assert(sb0.mB == 13);
|
||||
Test.Assert(sb6.mB == 13);
|
||||
|
||||
StructA sa7 = sa0;
|
||||
sa7 += .(100);
|
||||
Test.Assert(sa7.mA == 103);
|
||||
|
||||
float val = Op((int32)100, (int16)23);
|
||||
Test.Assert(val == 123);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue