예제 #1
0
 public void Clear()
 {
     Assignments.Clear();
     OriginalAssignments.Clear();
     replacerVisitor = null;
     RightNodeReplacements?.Clear();
 }
예제 #2
0
        protected override Expression VisitBinary(BinaryExpression node)
        {
            if (node.NodeType == ExpressionType.Equal)
            {
                var rightNode = node.Right;

                if (MakeRightNodeReplacements && RightNodeReplacements?.Count > 0)
                {
                    //replace all the parameter calls on the right with a vars get call instead
                    if (replacerVisitor == null)
                    {
                        replacerVisitor = new ReplacerExpressionVisitor(RightNodeReplacements);
                    }

                    rightNode = replacerVisitor.Visit(rightNode);
                }

                Assignments[node.Left]         = rightNode;
                OriginalAssignments[node.Left] = node.Right;

                return(Expression.Constant(true));
            }

            return(base.VisitBinary(node));
        }