BinaryOperator
Abstract base class for all binary operators
using System.Runtime.CompilerServices;
namespace NUnit.Framework.Constraints
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public abstract class BinaryOperator : ConstraintOperator
{
public override int LeftPrecedence {
get {
if (!(base.RightContext is CollectionOperator) && !(base.RightContext is ExactCountOperator) && !(base.RightContext is IndexerOperator))
return base.LeftPrecedence;
return base.LeftPrecedence + 10;
}
}
public override int RightPrecedence {
get {
if (!(base.RightContext is CollectionOperator))
return base.RightPrecedence;
return base.RightPrecedence + 10;
}
}
public override void Reduce(ConstraintBuilder.ConstraintStack stack)
{
IConstraint right = stack.Pop();
IConstraint left = stack.Pop();
stack.Push(ApplyOperator(left, right));
}
public abstract IConstraint ApplyOperator(IConstraint left, IConstraint right);
}
}