fragment_spread: pedantic
This commit is contained in:
parent
517d3ee316
commit
a749205c1a
1 changed files with 17 additions and 4 deletions
|
@ -3,17 +3,30 @@ import 'directive.dart';
|
||||||
import 'node.dart';
|
import 'node.dart';
|
||||||
import 'package:source_span/source_span.dart';
|
import 'package:source_span/source_span.dart';
|
||||||
|
|
||||||
|
/// A GraphQL fragment spread.
|
||||||
class FragmentSpreadContext extends Node {
|
class FragmentSpreadContext extends Node {
|
||||||
final Token ELLIPSIS, NAME;
|
/// The source tokens.
|
||||||
|
final Token ellipsisToken, nameToken;
|
||||||
|
|
||||||
|
/// Any directives affixed to this fragment spread.
|
||||||
final List<DirectiveContext> directives = [];
|
final List<DirectiveContext> directives = [];
|
||||||
|
|
||||||
FragmentSpreadContext(this.ELLIPSIS, this.NAME);
|
FragmentSpreadContext(this.ellipsisToken, this.nameToken);
|
||||||
|
|
||||||
String get name => NAME.text;
|
/// The [String] value of the [nameToken].
|
||||||
|
String get name => nameToken.text;
|
||||||
|
|
||||||
|
/// Use [ellipsisToken] instead.
|
||||||
|
@deprecated
|
||||||
|
Token get ELLIPSIS => ellipsisToken;
|
||||||
|
|
||||||
|
/// Use [nameToken] instead.
|
||||||
|
@deprecated
|
||||||
|
Token get NAME => nameToken;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FileSpan get span {
|
FileSpan get span {
|
||||||
var out = ELLIPSIS.span.expand(NAME.span);
|
var out = ellipsisToken.span.expand(nameToken.span);
|
||||||
if (directives.isEmpty) return out;
|
if (directives.isEmpty) return out;
|
||||||
return directives.fold<FileSpan>(out, (o, d) => o.expand(d.span));
|
return directives.fold<FileSpan>(out, (o, d) => o.expand(d.span));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue