pedantic: inline_fragment

This commit is contained in:
Tobe O 2019-08-07 22:53:28 -04:00
parent a749205c1a
commit fcbf95fc3f

View file

@ -5,18 +5,35 @@ import 'package:source_span/source_span.dart';
import 'selection_set.dart';
import 'type_condition.dart';
/// An inline fragment, which typically appears in a [SelectionSetContext].
class InlineFragmentContext extends Node {
final Token ELLIPSIS, ON;
/// The source tokens.
final Token ellipsisToken, onToken;
/// The type which this fragment matches.
final TypeConditionContext typeCondition;
/// Any directives affixed to this inline fragment.
final List<DirectiveContext> directives = [];
/// The selections applied when the [typeCondition] is met.
final SelectionSetContext selectionSet;
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
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));
return out.expand(selectionSet.span);
}