protected override void VisitEnumTypeDefinition(
     EnumTypeDefinitionNode node,
     object context)
 {
     _visited.Add(nameof(VisitEnumTypeDefinition));
     base.VisitEnumTypeDefinition(node, context);
 }
Exemple #2
0
        public void EnumTypeDefinitionWithLocation()
        {
            // 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 description = new StringValueNode("bar");
            var directives  = new List <DirectiveNode>();
            var values      = new List <EnumValueDefinitionNode>();


            // act
            var type = new EnumTypeDefinitionNode(
                location,
                name,
                description,
                directives,
                values);

            // assert
            Assert.Equal(NodeKind.EnumTypeDefinition, type.Kind);
            Assert.Equal(location, type.Location);
            Assert.Equal(name, type.Name);
            Assert.Equal(description, type.Description);
            Assert.Equal(directives, type.Directives);
            Assert.Equal(values, type.Values);
        }
        public void EnumTypeDefinitionWithLocation()
        {
            // arrange
            var location    = new Location(0, 0, 0, 0);
            var name        = new NameNode("foo");
            var description = new StringValueNode("bar");
            var directives  = new List <DirectiveNode>();
            var values      = new List <EnumValueDefinitionNode>();


            // act
            var type = new EnumTypeDefinitionNode(
                location,
                name,
                description,
                directives,
                values);

            // assert
            Assert.Equal(NodeKind.EnumTypeDefinition, type.Kind);
            Assert.Equal(location, type.Location);
            Assert.Equal(name, type.Name);
            Assert.Equal(description, type.Description);
            Assert.Equal(directives, type.Directives);
            Assert.Equal(values, type.Values);
        }
Exemple #4
0
        public void WithDescription()
        {
            // 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 description = new StringValueNode("bar");
            var directives  = new List <DirectiveNode>();
            var values      = new List <EnumValueDefinitionNode>();

            var type = new EnumTypeDefinitionNode(
                location,
                name,
                description,
                directives,
                values);

            // act
            type = type.WithDescription(new StringValueNode("baz"));


            // assert
            Assert.Equal("baz", type.Description.Value);
        }
        protected virtual void ResolveChildren(
            EnumTypeDefinitionNode node,
            IList <SyntaxNodeInfo> children)
        {
            if (node.Description is not null)
            {
                ResolveChildren(
                    nameof(node.Description),
                    node.Description,
                    children);
            }

            ResolveChildren(
                nameof(node.Name),
                node.Name,
                children);

            ResolveChildren(
                nameof(node.Directives),
                node.Directives,
                children);

            ResolveChildren(
                nameof(node.Values),
                node.Values,
                children);
        }
 public virtual VisitorAction Leave(
     EnumTypeDefinitionNode node,
     ISyntaxNode parent,
     IReadOnlyList <object> path,
     IReadOnlyList <ISyntaxNode> ancestors)
 {
     return(GetDefaultAction(node.Kind));
 }
Exemple #7
0
 protected override void VisitEnumTypeDefinition(
     EnumTypeDefinitionNode node)
 {
     VisitName(node.Name);
     VisitIfNotNull(node.Description, VisitStringValue);
     VisitMany(node.Directives, VisitDirective);
     VisitMany(node.Values, VisitEnumValueDefinition);
 }
        protected virtual EnumTypeDefinitionNode RewriteEnumTypeDefinition(
            EnumTypeDefinitionNode node,
            TContext context)
        {
            EnumTypeDefinitionNode current = node;

            current = RewriteDirectives(current, current.Directives,
                                        context, current.WithDirectives);

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

            current = Rewrite(current, current.Description, context,
                              RewriteStringValue, current.WithDescription);

            current = RewriteMany(current, current.Values, context,
                                  RewriteEnumValueDefinition, current.WithValues);

            return(current);
        }
        protected override void VisitEnumTypeDefinition(
            EnumTypeDefinitionNode node,
            DocumentWriter writer)
        {
            WriteDescription(node.Description, writer);

            writer.Write(Keywords.Enum);
            writer.WriteSpace();
            writer.WriteName(node.Name);

            WriteDirectives(node.Directives, writer);

            WriteLeftBrace(writer);

            writer.Indent();
            writer.WriteMany(
                node.Values,
                VisitEnumValueDefinition,
                WriteLineOrSpace);
            writer.Unindent();

            WriteRightBrace(writer);
        }
        public void WithLocation()
        {
            // arrange
            var location    = new Location(0, 0, 0, 0);
            var name        = new NameNode("foo");
            var description = new StringValueNode("bar");
            var directives  = new List <DirectiveNode>();
            var values      = new List <EnumValueDefinitionNode>();

            var type = new EnumTypeDefinitionNode(
                null,
                name,
                description,
                directives,
                values);

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


            // assert
            Assert.Equal(location, type.Location);
        }
Exemple #11
0
 protected virtual void VisitEnumTypeDefinition(
     EnumTypeDefinitionNode node)
 {
 }
Exemple #12
0
 protected virtual void VisitEnumTypeDefinition(
     EnumTypeDefinitionNode node,
     TContext context)
 {
 }