public static OperatorExpression Build(Operator op, VisitedExpression exp) { if (op.UnaryType == Operator.UnaryTypes.Prefix) { return new OperatorExpression(op, null, exp); } else if (op.UnaryType == Operator.UnaryTypes.Postfix) { return new OperatorExpression(op, exp, null); } else { throw new InvalidOperationException("Binary operator with one operand"); } }
private OperatorExpression(Operator op, VisitedExpression left, VisitedExpression right) { this.op = op; this.left = left; this.right = right; }
public static OperatorExpression Build(Operator op, VisitedExpression left, VisitedExpression right) { if (op.UnaryType == Operator.UnaryTypes.Binary) { return new OperatorExpression(op, left, right); } else { throw new InvalidOperationException("Unary operator with two operands"); } }
private OperatorExpression(Operator op, bool useNewPrecedences, VisitedExpression left, VisitedExpression right) { this.op = op; this.useNewPrecedences = useNewPrecedences; this.left = left; this.right = right; }