pedantic: frag def
This commit is contained in:
parent
5182ff0bf2
commit
6490324a09
1 changed files with 28 additions and 7 deletions
|
@ -5,22 +5,43 @@ import 'package:source_span/source_span.dart';
|
||||||
import 'selection_set.dart';
|
import 'selection_set.dart';
|
||||||
import 'type_condition.dart';
|
import 'type_condition.dart';
|
||||||
|
|
||||||
|
/// A GraphQL query fragment definition.
|
||||||
class FragmentDefinitionContext extends ExecutableDefinitionContext {
|
class FragmentDefinitionContext extends ExecutableDefinitionContext {
|
||||||
final Token FRAGMENT, NAME, ON;
|
/// The source tokens.
|
||||||
|
final Token fragmentToken, nameToken, onToken;
|
||||||
|
|
||||||
|
/// The type to which this fragment applies.
|
||||||
final TypeConditionContext typeCondition;
|
final TypeConditionContext typeCondition;
|
||||||
|
|
||||||
|
/// Any directives on the fragment.
|
||||||
final List<DirectiveContext> directives = [];
|
final List<DirectiveContext> directives = [];
|
||||||
|
|
||||||
|
/// The selections to apply when the [typeCondition] is met.
|
||||||
final SelectionSetContext selectionSet;
|
final SelectionSetContext selectionSet;
|
||||||
|
|
||||||
String get name => NAME.text;
|
/// The [String] value of the [nameToken].
|
||||||
|
String get name => nameToken.text;
|
||||||
|
|
||||||
FragmentDefinitionContext(
|
FragmentDefinitionContext(this.fragmentToken, this.nameToken, this.onToken,
|
||||||
this.FRAGMENT, this.NAME, this.ON, this.typeCondition, this.selectionSet);
|
this.typeCondition, this.selectionSet);
|
||||||
|
|
||||||
|
/// Use [fragmentToken] instead.
|
||||||
|
@deprecated
|
||||||
|
Token get FRAGMENT => fragmentToken;
|
||||||
|
|
||||||
|
/// Use [nameToken] instead.
|
||||||
|
@deprecated
|
||||||
|
Token get NAME => nameToken;
|
||||||
|
|
||||||
|
/// Use [onToken] instead.
|
||||||
|
@deprecated
|
||||||
|
Token get ON => onToken;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FileSpan get span {
|
FileSpan get span {
|
||||||
var out = FRAGMENT.span
|
var out = fragmentToken.span
|
||||||
.expand(NAME.span)
|
.expand(nameToken.span)
|
||||||
.expand(ON.span)
|
.expand(onToken.span)
|
||||||
.expand(typeCondition.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