Skip to content

Commit

Permalink
Accept kitchen-sink.graphql again (type conditions on inline fragment…
Browse files Browse the repository at this point in the history
…s are optional)
  • Loading branch information
swolchok committed Jan 4, 2016
1 parent f9a84e5 commit 8feed9c
Show file tree
Hide file tree
Showing 5 changed files with 248 additions and 232 deletions.
6 changes: 4 additions & 2 deletions JsonVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,12 @@ void JsonVisitor::endVisitInlineFragment(const InlineFragment &inlineFragment) {

const auto &children = printed_.back();

out_ << "\"typeCondition\":" << children[0];
auto nextChild = children.begin();
if (inlineFragment.getTypeCondition() != nullptr) {
out_ << "\"typeCondition\":" << *nextChild++;
}

out_ << ",\"directives\":";
auto nextChild = children.begin() + 1;
const auto *directives = inlineFragment.getDirectives();
if (directives != nullptr) {
printChildArray(nextChild, directives->size());
Expand Down
2 changes: 1 addition & 1 deletion ast/ast.ast
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ S Name name
P? Directive directives

T InlineFragment
S NamedType typeCondition
S? NamedType typeCondition
P? Directive directives
S SelectionSet selectionSet

Expand Down
Loading

0 comments on commit 8feed9c

Please sign in to comment.