File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -525,6 +525,12 @@ struct ast_selector<schema_extension>
525525{
526526};
527527
528+ template <>
529+ struct ast_selector <operation_type_definition>
530+ : std::true_type
531+ {
532+ };
533+
528534template <>
529535struct ast_selector <scalar_type_extension>
530536 : std::true_type
Original file line number Diff line number Diff line change @@ -316,11 +316,14 @@ bool Generator::fixupInputFieldList(InputFieldList& fields)
316316
317317void Generator::visitDefinition (const peg::ast_node& definition)
318318{
319- if (definition.is <peg::schema_definition>()
320- || definition.is <peg::schema_extension>())
319+ if (definition.is <peg::schema_definition>())
321320 {
322321 visitSchemaDefinition (definition);
323322 }
323+ else if (definition.is <peg::schema_extension>())
324+ {
325+ visitSchemaExtension (definition);
326+ }
324327 else if (definition.is <peg::scalar_type_definition>())
325328 {
326329 visitScalarTypeDefinition (definition);
@@ -383,6 +386,18 @@ void Generator::visitSchemaDefinition(const peg::ast_node& schemaDefinition)
383386 });
384387}
385388
389+ void Generator::visitSchemaExtension (const peg::ast_node& schemaExtension)
390+ {
391+ peg::for_each_child<peg::operation_type_definition>(schemaExtension,
392+ [this ](const peg::ast_node & child)
393+ {
394+ std::string operation (child.children .front ()->content ());
395+ std::string name (child.children .back ()->content ());
396+
397+ _operationTypes.push_back ({ std::move (name), std::move (operation) });
398+ });
399+ }
400+
386401void Generator::visitObjectTypeDefinition (const peg::ast_node& objectTypeDefinition)
387402{
388403 std::string name;
Original file line number Diff line number Diff line change @@ -209,6 +209,7 @@ class Generator
209209 void visitDefinition (const peg::ast_node& definition);
210210
211211 void visitSchemaDefinition (const peg::ast_node& schemaDefinition);
212+ void visitSchemaExtension (const peg::ast_node& schemaExtension);
212213 void visitScalarTypeDefinition (const peg::ast_node& scalarTypeDefinition);
213214 void visitEnumTypeDefinition (const peg::ast_node& enumTypeDefinition);
214215 void visitEnumTypeExtension (const peg::ast_node& enumTypeExtension);
You can’t perform that action at this time.
0 commit comments