pedantic: inline_fragment
This commit is contained in:
parent
a749205c1a
commit
fcbf95fc3f
1 changed files with 20 additions and 3 deletions
|
@ -5,18 +5,35 @@ import 'package:source_span/source_span.dart';
|
||||||
import 'selection_set.dart';
|
import 'selection_set.dart';
|
||||||
import 'type_condition.dart';
|
import 'type_condition.dart';
|
||||||
|
|
||||||
|
/// An inline fragment, which typically appears in a [SelectionSetContext].
|
||||||
class InlineFragmentContext extends Node {
|
class InlineFragmentContext extends Node {
|
||||||
final Token ELLIPSIS, ON;
|
/// The source tokens.
|
||||||
|
final Token ellipsisToken, onToken;
|
||||||
|
|
||||||
|
/// The type which this fragment matches.
|
||||||
final TypeConditionContext typeCondition;
|
final TypeConditionContext typeCondition;
|
||||||
|
|
||||||
|
/// Any directives affixed to this inline fragment.
|
||||||
final List<DirectiveContext> directives = [];
|
final List<DirectiveContext> directives = [];
|
||||||
|
|
||||||
|
/// The selections applied when the [typeCondition] is met.
|
||||||
final SelectionSetContext selectionSet;
|
final SelectionSetContext selectionSet;
|
||||||
|
|
||||||
InlineFragmentContext(
|
InlineFragmentContext(
|
||||||
this.ELLIPSIS, this.ON, this.typeCondition, this.selectionSet);
|
this.ellipsisToken, this.onToken, this.typeCondition, this.selectionSet);
|
||||||
|
|
||||||
|
/// Use [ellipsisToken] instead.
|
||||||
|
@deprecated
|
||||||
|
Token get ELLIPSIS => ellipsisToken;
|
||||||
|
|
||||||
|
/// Use [onToken] instead.
|
||||||
|
@deprecated
|
||||||
|
Token get ON => onToken;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FileSpan get span {
|
FileSpan get span {
|
||||||
var out = ELLIPSIS.span.expand(ON.span).expand(typeCondition.span);
|
var out =
|
||||||
|
ellipsisToken.span.expand(onToken.span).expand(typeCondition.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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue