public static Operator Create(OperatorType operatorType, params Expression[] children) { if (operatorType.Arity() == 1) { (children.Count() == 1).AssertTrue(); return new UnaryOperator(operatorType, children.First()); } else if (operatorType.Arity() == 2) { (children.Count() == 2).AssertTrue(); return new BinaryOperator(operatorType, children.First(), children.Second()); } else { throw AssertionHelper.Fail(); } }
public static Operator Create(OperatorType operatorType, params Expression[] children) { if (operatorType.Arity() == 1) { (children.Count() == 1).AssertTrue(); return(new UnaryOperator(operatorType, children.First())); } else if (operatorType.Arity() == 2) { (children.Count() == 2).AssertTrue(); return(new BinaryOperator(operatorType, children.First(), children.Second())); } else { throw AssertionHelper.Fail(); } }
protected Operator(OperatorType operatorType, params Expression[] children) : base(NodeType.Operator, children) { OperatorType = operatorType; var expectedArgc = operatorType.Arity(); (children.Count() == expectedArgc).AssertTrue(); }
public static Operator Create(OperatorType operatorType) { return Create(operatorType, operatorType.Arity().Times((Expression)null)); }
public static Operator Create(OperatorType operatorType) { return(Create(operatorType, operatorType.Arity().Times((Expression)null))); }
protected Operator(OperatorType operatorType) : this(operatorType, operatorType.Arity().Times((Expression)null)) { }