public static bool Compare(ICompilerOperator op1, ICompilerOperator op2) { if ((op1 == Ternary || op1 == RhsTernary) && (op2 == Ternary || op2 == RhsTernary)) { return(op1 == RhsTernary && op2 == RhsTernary); } if (op1 == Sentinel || op2 == Sentinel) { return(false); } return(op1.Precedence > op2.Precedence); }
public static bool Compare(ICompilerOperator op1, ICompilerOperator op2) { if ((op1 == Ternary || op1 == RhsTernary) && (op2 == Ternary || op2 == RhsTernary)) { return(op1 == RhsTernary && op2 == RhsTernary); } if (op1 == Sentinel || op2 == Sentinel) { return(false); } return(op1.Precedence >= op2.Precedence && !(op1 is CompilerOperator op1co && op1co.Type == OperatorType.Unary && op2 is CompilerOperator op2co && op2co.Type == OperatorType.Unary)); }