2017-01-22 23:15:53 +00:00
|
|
|
import '../token.dart';
|
|
|
|
import 'definition.dart';
|
|
|
|
import 'directive.dart';
|
2017-07-05 22:44:13 +00:00
|
|
|
import 'package:source_span/source_span.dart';
|
2017-01-22 23:15:53 +00:00
|
|
|
import 'selection_set.dart';
|
|
|
|
import 'type_condition.dart';
|
|
|
|
|
2019-03-29 18:32:31 +00:00
|
|
|
class FragmentDefinitionContext extends ExecutableDefinitionContext {
|
2017-01-22 23:15:53 +00:00
|
|
|
final Token FRAGMENT, NAME, ON;
|
|
|
|
final TypeConditionContext typeCondition;
|
|
|
|
final List<DirectiveContext> directives = [];
|
|
|
|
final SelectionSetContext selectionSet;
|
|
|
|
|
|
|
|
String get name => NAME.text;
|
|
|
|
|
|
|
|
FragmentDefinitionContext(
|
|
|
|
this.FRAGMENT, this.NAME, this.ON, this.typeCondition, this.selectionSet);
|
|
|
|
|
|
|
|
@override
|
2017-07-05 22:44:13 +00:00
|
|
|
FileSpan get span {
|
|
|
|
var out = FRAGMENT.span
|
|
|
|
.expand(NAME.span)
|
|
|
|
.expand(ON.span)
|
|
|
|
.expand(typeCondition.span);
|
|
|
|
out = directives.fold<FileSpan>(out, (o, d) => o.expand(d.span));
|
|
|
|
return out.expand(selectionSet.span);
|
|
|
|
}
|
2017-01-22 23:15:53 +00:00
|
|
|
}
|