protected override void VisitArgument(ArgumentNode node)
        {
            VisitName(node.Name);

            _writer.Write(": ");

            VisitValue(node.Value);
        }
Exemplo n.º 2
0
 public virtual VisitorAction Leave(
     ArgumentNode node,
     ISyntaxNode parent,
     IReadOnlyList <object> path,
     IReadOnlyList <ISyntaxNode> ancestors)
 {
     return(GetDefaultAction(node.Kind));
 }
Exemplo n.º 3
0
        public void Argument_ToString_UnIndented()
        {
            // arrange
            var name  = new NameNode("foo");
            var value = new StringValueNode("bar");

            // act
            var argument = new ArgumentNode(null, name, value);

            // assert
            argument.ToString(false).MatchSnapshot();
        }
Exemplo n.º 4
0
        public void ArgumentNode_WithNewValue_NewValueIsSet()
        {
            // arrange
            var argument = new ArgumentNode(
                "foo", new StringValueNode("bar"));

            // act
            argument = argument.WithValue(new StringValueNode("foo"));

            // assert
            Assert.Equal("foo", ((StringValueNode)argument.Value).Value);
        }
Exemplo n.º 5
0
        public void ArgumentNode_WithNewName_NewNameIsSet()
        {
            // arrange
            var argument = new ArgumentNode(
                "foo", new StringValueNode("bar"));

            // act
            argument = argument.WithName(new NameNode("bar"));

            // assert
            Assert.Equal("bar", argument.Name.Value);
        }
Exemplo n.º 6
0
        protected virtual void ResolveChildren(
            ArgumentNode node,
            IList <SyntaxNodeInfo> children)
        {
            ResolveChildren(
                nameof(node.Name),
                node.Name,
                children);

            ResolveChildren(
                nameof(node.Value),
                node.Value,
                children);
        }
Exemplo n.º 7
0
        protected virtual ArgumentNode RewriteArgument(
            ArgumentNode node,
            TContext context)
        {
            ArgumentNode current = node;

            current = Rewrite(current, node.Name, context,
                              RewriteName, current.WithName);

            current = Rewrite(current, node.Value, context,
                              RewriteValue, current.WithValue);

            return(current);
        }
Exemplo n.º 8
0
        public void CreateArgumentWithConvenienceConstructor()
        {
            // arrange
            var name  = "foo";
            var value = new StringValueNode("bar");

            // act
            var argument = new ArgumentNode(name, value);

            // assert
            Assert.Equal(NodeKind.Argument, argument.Kind);
            Assert.Null(argument.Location);
            Assert.Equal(name, argument.Name.Value);
            Assert.Equal(value, argument.Value);
        }
Exemplo n.º 9
0
        public void Argument_GetNodes()
        {
            // arrange
            var name     = new NameNode("foo");
            var value    = new StringValueNode("bar");
            var argument = new ArgumentNode(null, name, value);

            // act
            ISyntaxNode[] nodes = argument.GetNodes().ToArray();

            // assert
            Assert.Collection(nodes,
                              n => Assert.Equal(name, n),
                              v => Assert.Equal(value, v));
        }
Exemplo n.º 10
0
        public void CreateArgumentWithoutLocation()
        {
            // arrange
            var name  = new NameNode("foo");
            var value = new StringValueNode("bar");

            // act
            var argument = new ArgumentNode(name, value);

            // assert
            Assert.Equal(NodeKind.Argument, argument.Kind);
            Assert.Null(argument.Location);
            Assert.Equal(name, argument.Name);
            Assert.Equal(value, argument.Value);
        }
Exemplo n.º 11
0
        public void CreateArgumentWithLocation()
        {
            // arrange
            var location = new Location(0, 0, 0, 0);
            var name     = new NameNode("foo");
            var value    = new StringValueNode("bar");

            // act
            var argument = new ArgumentNode(location, name, value);

            // assert
            Assert.Equal(SyntaxKind.Argument, argument.Kind);
            Assert.Equal(location, argument.Location);
            Assert.Equal(name, argument.Name);
            Assert.Equal(value, argument.Value);
        }
Exemplo n.º 12
0
        public void ArgumentNode_WithNewLocation_NewLocationIsSet()
        {
            // arrange
            var argument = new ArgumentNode(
                "foo",
                new StringValueNode("bar"));

            Assert.Null(argument.Location);

            var location = new Location(0, 0, 0, 0);

            // act
            argument = argument.WithLocation(location);

            // assert
            Assert.Equal(location, argument.Location);
        }
Exemplo n.º 13
0
        public void CreateArgumentWithLocation()
        {
            // arrange
            var source = new Source("foo");
            var start  = new SyntaxToken(
                TokenKind.StartOfFile, 0, 0, 1, 1, null);
            var location = new Location(source, start, start);
            var name     = new NameNode("foo");
            var value    = new StringValueNode("bar");

            // act
            var argument = new ArgumentNode(location, name, value);

            // assert
            Assert.Equal(NodeKind.Argument, argument.Kind);
            Assert.Equal(location, argument.Location);
            Assert.Equal(name, argument.Name);
            Assert.Equal(value, argument.Value);
        }
Exemplo n.º 14
0
 protected virtual void VisitArgument(
     ArgumentNode node,
     TContext context)
 {
 }
Exemplo n.º 15
0
 protected override void VisitArgument(ArgumentNode node)
 {
     WriteField(node.Name, node.Value);
 }
Exemplo n.º 16
0
 protected virtual void VisitArgument(ArgumentNode node)
 {
 }
 public static void WriteArgument(
     this DocumentWriter writer,
     ArgumentNode node)
 {
     writer.WriteField(node.Name, node.Value);
 }