Fix span expansion when operation name is null

This commit is contained in:
Tobe O 2018-08-03 23:20:16 -04:00
parent 1db4a33e05
commit da150d8a6a

View file

@ -26,7 +26,7 @@ class OperationDefinitionContext extends DefinitionContext {
@override @override
FileSpan get span { FileSpan get span {
if (TYPE == null) return selectionSet.span; if (TYPE == null) return selectionSet.span;
var out = TYPE.span.expand(NAME.span); var out = NAME == null ? TYPE.span : TYPE.span.expand(NAME.span);
out = directives.fold<FileSpan>(out, (o, d) => o.expand(d.span)); out = directives.fold<FileSpan>(out, (o, d) => o.expand(d.span));
return out.expand(selectionSet.span); return out.expand(selectionSet.span);
} }