public void AddFingerprint(ExpressionFingerprint fingerprint)
 {
     if (fingerprint != null)
         fingerprint.AddToHashCodeCombiner(this);
     else
         AddInt32(0);
 }
        public static ConditionalExpressionFingerprint Create(
            ConditionalExpression expression, ParserContext context)
        {
            ExpressionFingerprint test = Create(expression.Test, context);

            if (test == null && expression.Test != null)
            {
                return(null);
            }

            ExpressionFingerprint ifTrue = Create(expression.IfTrue, context);

            if (ifTrue == null && expression.IfTrue != null)
            {
                return(null);
            }

            ExpressionFingerprint ifFalse = Create(expression.IfFalse, context);

            if (ifFalse == null && expression.IfFalse != null)
            {
                return(null);
            }

            return(new ConditionalExpressionFingerprint(expression)
            {
                _test = test, _ifTrue = ifTrue, _ifFalse = ifFalse
            });
        }
        public static BinaryExpressionFingerprint Create(
            BinaryExpression expression, ParserContext context)
        {
            if (expression.Conversion != null)
            {
                return(null);
            }

            ExpressionFingerprint left = Create(expression.Left, context);

            if (left == null && expression.Left != null)
            {
                return(null);
            }

            ExpressionFingerprint right = Create(expression.Right, context);

            if (right == null && expression.Right != null)
            {
                return(null);
            }

            return(new BinaryExpressionFingerprint(expression)
            {
                _left = left, _right = right
            });
        }
 public void AddFingerprint(ExpressionFingerprint fingerprint)
 {
     if (fingerprint != null)
     {
         fingerprint.AddToHashCodeCombiner(this);
     }
     else
     {
         AddInt32(0);
     }
 }
Esempio n. 5
0
        public override bool Equals(object obj)
        {
            ExpressionFingerprint other = (obj as ExpressionFingerprint);

            if (other == null)
            {
                return(false);
            }

            return(_nodeType == other.NodeType && _type == other.Type &&
                   GetType() == other.GetType());
        }
        public static ParserContext Parse <TClass, TMember>(
            Expression <Func <TClass, TMember> > expression)
        {
            ParserContext context = new ParserContext()
            {
                Instance = expression.Parameters[0]
            };

            Expression body = expression.Body;

            context.Fingerprint = ExpressionFingerprint.Create(body, context);

            return(context);
        }
        public static MemberExpressionFingerprint Create(
            MemberExpression expression, ParserContext context)
        {
            ExpressionFingerprint target = Create(expression.Expression, context);

            if (target == null && expression.Expression != null)
            {
                return(null);
            }

            return(new MemberExpressionFingerprint(expression)
            {
                _target = target
            });
        }
        public static UnaryExpressionFingerprint Create(
            UnaryExpression expression, ParserContext context)
        {
            ExpressionFingerprint operand = Create(expression.Operand, context);

            if (operand == null && expression.Operand != null)
            {
                return(null);
            }

            return(new UnaryExpressionFingerprint(expression)
            {
                _operand = operand
            });
        }
Esempio n. 9
0
        public static ReadOnlyCollection <ExpressionFingerprint> Create(
            IEnumerable <Expression> expressions, ParserContext context)
        {
            List <ExpressionFingerprint> fingerprints = new List <ExpressionFingerprint>();

            foreach (Expression expression in expressions)
            {
                ExpressionFingerprint fingerprint = Create(expression, context);
                if (fingerprint == null && expression != null)
                {
                    return(null);
                }

                fingerprints.Add(fingerprint);
            }
            return(new ReadOnlyCollection <ExpressionFingerprint>(fingerprints));
        }
        public static MethodCallExpressionFingerprint Create(
            MethodCallExpression expression, ParserContext context)
        {
            ReadOnlyCollection <ExpressionFingerprint> arguments =
                Create(expression.Arguments, context);

            if (arguments == null)
            {
                return(null);
            }

            ExpressionFingerprint target = Create(expression.Object, context);

            if (target == null && expression.Object != null)
            {
                return(null);
            }

            return(new MethodCallExpressionFingerprint(expression)
            {
                _arguments = arguments,
                _target = target
            });
        }
Esempio n. 11
0
 protected static Expression ToExpression(ExpressionFingerprint fingerprint, ParserContext context)
 {
     return((fingerprint == null) ? null : fingerprint.ToExpression(context));
 }
 protected static Expression ToExpression(ExpressionFingerprint fingerprint, ParserContext context)
 {
     return (fingerprint == null) ? null : fingerprint.ToExpression(context);
 }