From 6455dde6b6a79f86fbff2d84ac58ed3ff78ee083 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 7 Aug 2019 22:24:02 -0400 Subject: [PATCH] pedantic: ast/alias.dart --- graphql_parser/analysis_options.yaml | 1 + .../lib/src/language/ast/alias.dart | 25 ++++++++++++++----- graphql_parser/pubspec.yaml | 1 + 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/graphql_parser/analysis_options.yaml b/graphql_parser/analysis_options.yaml index eae1e42a..c230cee7 100644 --- a/graphql_parser/analysis_options.yaml +++ b/graphql_parser/analysis_options.yaml @@ -1,3 +1,4 @@ +include: package:pedantic/analysis_options.yaml analyzer: strong-mode: implicit-casts: false \ No newline at end of file diff --git a/graphql_parser/lib/src/language/ast/alias.dart b/graphql_parser/lib/src/language/ast/alias.dart index 986b4370..137be2bd 100644 --- a/graphql_parser/lib/src/language/ast/alias.dart +++ b/graphql_parser/lib/src/language/ast/alias.dart @@ -1,19 +1,32 @@ import 'package:source_span/source_span.dart'; - import '../token.dart'; import 'node.dart'; +/// An alternate name for a field within a [SelectionSet]. class AliasContext extends Node { - final Token NAME1, COLON, NAME2; + /// The source tokens. + final Token name1, colon, name2; - AliasContext(this.NAME1, this.COLON, this.NAME2); + AliasContext(this.name1, this.colon, this.name2); + + /// Use [name1] instead. + @deprecated + Token get NAME1 => name1; + + /// Use [colon] instead. + @deprecated + Token get COLON => colon; + + /// Use [name2] instead. + @deprecated + Token get NAME2 => name2; /// The aliased name of the value. - String get alias => NAME1.text; + String get alias => name1.text; /// The actual name of the value. - String get name => NAME2.text; + String get name => name2.text; @override - FileSpan get span => NAME1.span.expand(COLON.span).expand(NAME2.span); + FileSpan get span => name1.span.expand(colon.span).expand(name2.span); } diff --git a/graphql_parser/pubspec.yaml b/graphql_parser/pubspec.yaml index d5028445..2f6a1ca0 100644 --- a/graphql_parser/pubspec.yaml +++ b/graphql_parser/pubspec.yaml @@ -11,4 +11,5 @@ dependencies: string_scanner: ^1.0.0 dev_dependencies: matcher: any + pedantic: ^1.0.0 test: ">=0.12.0 <2.0.0"