Example #1
0
 internal void Accept(ExpressionObject obj)
 {
     if (Lhs == null)
     {
         Lhs = obj;
     }
     else if (Operator == null)
     {
         Operator = obj;
     }
     else
     {
         Rhs = obj;
     }
 }
Example #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));
        }
Example #3
0
 internal ExpressionObject Evaluate(ExecutionContext ctx, ExpressionObject lhs, ExpressionObject rhs)
 {
     return(Handlers[Source](ctx, lhs, rhs));
 }