pedantic: done (graphql_parser)
This commit is contained in:
parent
0fb5e16565
commit
9f28e73483
1 changed files with 18 additions and 5 deletions
|
@ -4,20 +4,33 @@ import '../token.dart';
|
||||||
import 'node.dart';
|
import 'node.dart';
|
||||||
import 'selection.dart';
|
import 'selection.dart';
|
||||||
|
|
||||||
|
/// A set of GraphQL selections - fields, fragments, or inline fragments.
|
||||||
class SelectionSetContext extends Node {
|
class SelectionSetContext extends Node {
|
||||||
final Token LBRACE, RBRACE;
|
/// The source tokens.
|
||||||
|
final Token lBraceToken, rBraceToken;
|
||||||
|
|
||||||
|
/// The selections to be applied.
|
||||||
final List<SelectionContext> selections = [];
|
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) =
|
factory SelectionSetContext.merged(List<SelectionContext> selections) =
|
||||||
_MergedSelectionSetContext;
|
_MergedSelectionSetContext;
|
||||||
|
|
||||||
|
/// Use [lBraceToken] instead.
|
||||||
|
@deprecated
|
||||||
|
Token get LBRACE => lBraceToken;
|
||||||
|
|
||||||
|
/// Use [rBraceToken] instead.
|
||||||
|
@deprecated
|
||||||
|
Token get RBRACE => rBraceToken;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FileSpan get span {
|
FileSpan get span {
|
||||||
var out =
|
var out = selections.fold<FileSpan>(
|
||||||
selections.fold<FileSpan>(LBRACE.span, (out, s) => out.expand(s.span));
|
lBraceToken.span, (out, s) => out.expand(s.span));
|
||||||
return out.expand(RBRACE.span);
|
return out.expand(rBraceToken.span);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue