parseInlineFragment method
Implementation
InlineFragmentContext? parseInlineFragment() {
if (next(TokenType.ELLIPSIS) && current != null) {
var ELLIPSIS = current!;
if (nextName('on')) {
var ON = current!;
var typeCondition = parseTypeCondition();
if (typeCondition != null) {
var directives = parseDirectives();
var selectionSet = parseSelectionSet();
if (selectionSet != null) {
return InlineFragmentContext(
ELLIPSIS, ON, typeCondition, selectionSet)
..directives.addAll(directives);
} else {
errors.add(SyntaxError(
'Missing selection set in inline fragment.',
directives.isEmpty
? typeCondition.span
: directives.last.span));
return null;
}
} else {
errors.add(SyntaxError(
'Missing type condition after "on" in inline fragment.',
ON.span));
return null;
}
} else {
errors.add(SyntaxError(
'Missing "on" after "..." in inline fragment.', ELLIPSIS.span));
return null;
}
} else {
return null;
}
}