Beispiel #1
0
 internal void Accept(ExpressionObject obj)
 {
     if (Lhs == null)
     {
         Lhs = obj;
     }
     else if (Operator == null)
     {
         Operator = obj;
     }
     else
     {
         Rhs = obj;
     }
 }
Beispiel #2
0
        private static (object left, object right) ProcessOperands(ExecutionContext ctx, ExpressionObject lhs, ExpressionObject rhs)
        {
            object lhsVal = lhs.Value(ctx);
            Type   target = lhs.IsNull(ctx) ? typeof(string) :
                            (BooleanExpressionObject.CouldParse(lhsVal) ?
                             typeof(bool) :
                             (NumberExpressionObject.CouldParse(lhsVal) ? typeof(decimal) : typeof(string)));

            return(left : ChangeType(lhsVal, target), right : ChangeType(rhs.Value(ctx), target));
        }
Beispiel #3
0
 internal ExpressionObject Evaluate(ExecutionContext ctx, ExpressionObject lhs, ExpressionObject rhs)
 {
     return(Handlers[Source](ctx, lhs, rhs));
 }