public FragmentDefinitionNode WithTypeCondition(
     NamedTypeNode typeCondition)
 {
     return(new FragmentDefinitionNode(
                Location, Name,
                typeCondition,
                Directives, SelectionSet));
 }
示例#2
0
 public OperationTypeDefinitionNode(
     Location location,
     OperationType operation,
     NamedTypeNode type)
 {
     Location  = location;
     Operation = operation;
     Type      = type ?? throw new ArgumentNullException(nameof(type));
 }
 public FragmentDefinitionNode(
     Location location,
     NameNode name,
     NamedTypeNode typeCondition,
     IReadOnlyList <DirectiveNode> directives,
     SelectionSetNode selectionSet)
     : base(location, name, directives)
 {
     TypeCondition = typeCondition
                     ?? throw new ArgumentNullException(nameof(typeCondition));
     SelectionSet = selectionSet
                    ?? throw new ArgumentNullException(nameof(selectionSet));
 }
示例#4
0
        /// <summary>
        /// Parses an operation type definition.
        /// <see cref="OperationTypeDefinitionNode" />:
        /// OperationType : NamedType
        /// </summary>
        /// <param name="context">The parser context.</param>
        private OperationTypeDefinitionNode ParseOperationTypeDefinition()
        {
            ISyntaxToken start = _reader.Token;

            OperationType operation = ParseOperationType();

            ExpectColon();
            NamedTypeNode type = ParseNamedType();

            var location = new Location(start, _reader.Token);

            return(new OperationTypeDefinitionNode
                   (
                       location,
                       operation,
                       type
                   ));
        }
        /// <summary>
        /// Parses a fragment definition.
        /// <see cref="FragmentDefinitionNode" />:
        /// fragment FragmentName on TypeCondition Directives? SelectionSet
        /// </summary>
        /// <param name="context">The parser context.</param>
        private FragmentDefinitionNode ParseFragmentDefinition()
        {
            ISyntaxToken start = _reader.Token;

            ExpectFragmentKeyword();

            NameNode name = ParseFragmentName();

            ExpectOnKeyword();
            NamedTypeNode        typeCondition = ParseNamedType();
            List <DirectiveNode> directives    = ParseDirectives(false);
            SelectionSetNode     selectionSet  = ParseSelectionSet();
            var location = new Location(start, _reader.Token);

            return(new FragmentDefinitionNode
                   (
                       location,
                       name,
                       typeCondition,
                       directives,
                       selectionSet
                   ));
        }
示例#6
0
 public OperationTypeDefinitionNode WithType(NamedTypeNode type)
 {
     return(new OperationTypeDefinitionNode(
                Location, Operation, type));
 }