예제 #1
0
        public void Visit(BinaryOperatorNode node)
        {
            var parenOnLeft  = node.GetPrecedence() < node.GetLeft().GetPrecedence();
            var parenOnRight = node.GetPrecedence() < node.GetRight().GetPrecedence();

            if (parenOnLeft)
            {
                source.Append("(");
            }
            node.GetLeft().Visit(this);
            if (parenOnLeft)
            {
                source.Append(")");
            }

            source.Append(" " + node.GetOperator() + " ");
            if (parenOnRight)
            {
                source.Append("(");
            }
            if (node.GetOperator() == "is" && node.GetRight() is IdentifierStringNode)
            {
                source.Append((node.GetRight() as IdentifierStringNode).GetIdentifier());
            }
            else
            {
                node.GetRight().Visit(this);
            }
            if (parenOnRight)
            {
                source.Append(")");
            }
        }
예제 #2
0
 public void Visit(BinaryOperatorNode node)
 {
     visitor.OnVisit((n, v) =>
     {
         var r = n as BinaryOperatorNode;
         if (r != null && r.GetOperator() == node.GetOperator())
         {
             Result = IsSameChildren(r, node);
         }
     });
     reference.Visit(visitor);
 }