@@ -19,7 +19,6 @@ import {
19
19
type VariableNode ,
20
20
type DocumentNode ,
21
21
type DefinitionNode ,
22
- type ExecutableDefinitionNode ,
23
22
type OperationDefinitionNode ,
24
23
type OperationTypeNode ,
25
24
type VariableDefinitionNode ,
@@ -217,15 +216,20 @@ class Parser {
217
216
* - ExecutableDefinition
218
217
* - TypeSystemDefinition
219
218
* - TypeSystemExtension
219
+ *
220
+ * ExecutableDefinition :
221
+ * - OperationDefinition
222
+ * - FragmentDefinition
220
223
*/
221
224
parseDefinition(): DefinitionNode {
222
225
if ( this . peek ( TokenKind . NAME ) ) {
223
226
switch ( this . _lexer . token . value ) {
224
227
case 'query' :
225
228
case 'mutation' :
226
229
case 'subscription' :
230
+ return this . parseOperationDefinition ( ) ;
227
231
case 'fragment' :
228
- return this . parseExecutableDefinition ( ) ;
232
+ return this . parseFragmentDefinition ( ) ;
229
233
case 'schema' :
230
234
case 'scalar' :
231
235
case 'type' :
@@ -239,37 +243,14 @@ class Parser {
239
243
return this . parseTypeSystemExtension ( ) ;
240
244
}
241
245
} else if ( this . peek ( TokenKind . BRACE_L ) ) {
242
- return this . parseExecutableDefinition ( ) ;
246
+ return this . parseOperationDefinition ( ) ;
243
247
} else if (this.peekDescription()) {
244
248
return this . parseTypeSystemDefinition ( ) ;
245
249
}
246
250
247
251
throw this.unexpected();
248
252
}
249
253
250
- /**
251
- * ExecutableDefinition :
252
- * - OperationDefinition
253
- * - FragmentDefinition
254
- */
255
- parseExecutableDefinition ( ) : ExecutableDefinitionNode {
256
- if ( this . peek ( TokenKind . NAME ) ) {
257
- switch ( this . _lexer . token . value ) {
258
- case 'query' :
259
- case 'mutation' :
260
- case 'subscription' :
261
- return this . parseOperationDefinition ( ) ;
262
-
263
- case 'fragment' :
264
- return this . parseFragmentDefinition ( ) ;
265
- }
266
- } else if ( this . peek ( TokenKind . BRACE_L ) ) {
267
- return this . parseOperationDefinition ( ) ;
268
- }
269
-
270
- throw this.unexpected();
271
- }
272
-
273
254
// Implements the parsing rules in the Operations section.
274
255
275
256
/**
0 commit comments