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();
     }
 }
Exemple #2
0
 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();
     }
 }
Exemple #3
0
        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));
 }
Exemple #5
0
 public static Operator Create(OperatorType operatorType)
 {
     return(Create(operatorType, operatorType.Arity().Times((Expression)null)));
 }
Exemple #6
0
 protected Operator(OperatorType operatorType)
     : this(operatorType, operatorType.Arity().Times((Expression)null))
 {
 }