From 5182ff0bf26dc7f84063c0fcdc86cb05a5af6031 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 7 Aug 2019 22:39:29 -0400 Subject: [PATCH] pedantic: ast/field_name.dart --- .../lib/src/language/ast/field_name.dart | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/graphql_parser/lib/src/language/ast/field_name.dart b/graphql_parser/lib/src/language/ast/field_name.dart index d6e80dea..4841d6ce 100644 --- a/graphql_parser/lib/src/language/ast/field_name.dart +++ b/graphql_parser/lib/src/language/ast/field_name.dart @@ -3,16 +3,25 @@ import '../token.dart'; import 'alias.dart'; import 'node.dart'; +/// The name of a GraphQL [FieldContext], which may or may not be [alias]ed. class FieldNameContext extends Node { - final Token NAME; + /// The source token. + final Token nameToken; + + /// An (optional) alias for the field. final AliasContext alias; - FieldNameContext(this.NAME, [this.alias]) { - assert(NAME != null || alias != null); + FieldNameContext(this.nameToken, [this.alias]) { + assert(nameToken != null || alias != null); } - String get name => NAME?.text; + /// Use [nameToken] instead. + @deprecated + Token get NAME => nameToken; + + /// The [String] value of the [nameToken], if any. + String get name => nameToken?.text; @override - FileSpan get span => alias?.span ?? NAME.span; + FileSpan get span => alias?.span ?? nameToken.span; }