mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +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);
|
argValues.Init(&sizedArgExprs);
|
||||||
ResolveArgValues(argValues, BfResolveArgsFlag_DeferParamEval);
|
ResolveArgValues(argValues, BfResolveArgsFlag_DeferParamEval);
|
||||||
rightArg = argValues.mResolvedArgs[0];
|
rightArg = argValues.mResolvedArgs[0];
|
||||||
if (!rightArg.mTypedValue)
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SizedArray<BfResolvedArg, 2> args;
|
SizedArray<BfResolvedArg, 2> args;
|
||||||
|
@ -24253,8 +24251,8 @@ void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNod
|
||||||
bool works = false;
|
bool works = false;
|
||||||
if (opConstraint.mBinaryOp == findBinaryOp)
|
if (opConstraint.mBinaryOp == findBinaryOp)
|
||||||
{
|
{
|
||||||
if ((mModule->CanCast(args[0].mTypedValue, opConstraint.mLeftType)) &&
|
if (((args[0].mTypedValue) && (mModule->CanCast(args[0].mTypedValue, opConstraint.mLeftType))) &&
|
||||||
(mModule->CanCast(args[1].mTypedValue, opConstraint.mRightType)))
|
((args[1].mTypedValue) && (mModule->CanCast(args[1].mTypedValue, opConstraint.mRightType))))
|
||||||
{
|
{
|
||||||
works = true;
|
works = true;
|
||||||
}
|
}
|
||||||
|
@ -24262,13 +24260,13 @@ void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNod
|
||||||
|
|
||||||
if ((isComparison) && (opConstraint.mBinaryOp == BfBinaryOp_Compare))
|
if ((isComparison) && (opConstraint.mBinaryOp == BfBinaryOp_Compare))
|
||||||
{
|
{
|
||||||
if ((mModule->CanCast(args[0].mTypedValue, opConstraint.mLeftType)) &&
|
if (((args[0].mTypedValue) && (mModule->CanCast(args[0].mTypedValue, opConstraint.mLeftType))) &&
|
||||||
(mModule->CanCast(args[1].mTypedValue, opConstraint.mRightType)))
|
((args[1].mTypedValue) && (mModule->CanCast(args[1].mTypedValue, opConstraint.mRightType))))
|
||||||
{
|
{
|
||||||
works = true;
|
works = true;
|
||||||
}
|
}
|
||||||
else if ((mModule->CanCast(args[0].mTypedValue, opConstraint.mRightType)) &&
|
else if (((args[0].mTypedValue) && (mModule->CanCast(args[0].mTypedValue, opConstraint.mRightType))) &&
|
||||||
(mModule->CanCast(args[1].mTypedValue, opConstraint.mLeftType)))
|
((args[1].mTypedValue) && (mModule->CanCast(args[1].mTypedValue, opConstraint.mLeftType))))
|
||||||
{
|
{
|
||||||
works = true;
|
works = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,11 @@ namespace Tests
|
||||||
{
|
{
|
||||||
public int mA;
|
public int mA;
|
||||||
|
|
||||||
|
public this(int a)
|
||||||
|
{
|
||||||
|
mA = a;
|
||||||
|
}
|
||||||
|
|
||||||
public static StructA operator+(StructA lhs, StructA rhs)
|
public static StructA operator+(StructA lhs, StructA rhs)
|
||||||
{
|
{
|
||||||
StructA res;
|
StructA res;
|
||||||
|
@ -557,6 +562,10 @@ namespace Tests
|
||||||
Test.Assert(sb0.mB == 13);
|
Test.Assert(sb0.mB == 13);
|
||||||
Test.Assert(sb6.mB == 13);
|
Test.Assert(sb6.mB == 13);
|
||||||
|
|
||||||
|
StructA sa7 = sa0;
|
||||||
|
sa7 += .(100);
|
||||||
|
Test.Assert(sa7.mA == 103);
|
||||||
|
|
||||||
float val = Op((int32)100, (int16)23);
|
float val = Op((int32)100, (int16)23);
|
||||||
Test.Assert(val == 123);
|
Test.Assert(val == 123);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue