pedantic: done (graphql_parser)

This commit is contained in:
Tobe O 2019-08-07 23:21:09 -04:00
parent 0fb5e16565
commit 9f28e73483

View file

@ -4,20 +4,33 @@ import '../token.dart';
import 'node.dart';
import 'selection.dart';
/// A set of GraphQL selections - fields, fragments, or inline fragments.
class SelectionSetContext extends Node {
final Token LBRACE, RBRACE;
/// The source tokens.
final Token lBraceToken, rBraceToken;
/// The selections to be applied.
final List<SelectionContext> selections = [];
SelectionSetContext(this.LBRACE, this.RBRACE);
SelectionSetContext(this.lBraceToken, this.rBraceToken);
/// A synthetic [SelectionSetContext] produced from a set of [selections].
factory SelectionSetContext.merged(List<SelectionContext> selections) =
_MergedSelectionSetContext;
/// Use [lBraceToken] instead.
@deprecated
Token get LBRACE => lBraceToken;
/// Use [rBraceToken] instead.
@deprecated
Token get RBRACE => rBraceToken;
@override
FileSpan get span {
var out =
selections.fold<FileSpan>(LBRACE.span, (out, s) => out.expand(s.span));
return out.expand(RBRACE.span);
var out = selections.fold<FileSpan>(
lBraceToken.span, (out, s) => out.expand(s.span));
return out.expand(rBraceToken.span);
}
}