From fcbf95fc3f02db3cc9f6bf441becbf08e98f2d6b Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 7 Aug 2019 22:53:28 -0400 Subject: [PATCH] pedantic: inline_fragment --- .../lib/src/language/ast/inline_fragment.dart | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/graphql_parser/lib/src/language/ast/inline_fragment.dart b/graphql_parser/lib/src/language/ast/inline_fragment.dart index 7f616bc5..d73a8080 100644 --- a/graphql_parser/lib/src/language/ast/inline_fragment.dart +++ b/graphql_parser/lib/src/language/ast/inline_fragment.dart @@ -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 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(out, (o, d) => o.expand(d.span)); return out.expand(selectionSet.span); }