From 5ef551e8df4b8a2e25a6d481b7f5f97f0ec88b52 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 7 Aug 2019 23:06:23 -0400 Subject: [PATCH] pedantic: variable --- .../lib/src/language/ast/variable.dart | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/graphql_parser/lib/src/language/ast/variable.dart b/graphql_parser/lib/src/language/ast/variable.dart index 96222aee..576734e4 100644 --- a/graphql_parser/lib/src/language/ast/variable.dart +++ b/graphql_parser/lib/src/language/ast/variable.dart @@ -2,17 +2,27 @@ import 'package:source_span/source_span.dart'; import '../token.dart'; import 'input_value.dart'; +/// A variable reference in GraphQL. class VariableContext extends InputValueContext { - final Token DOLLAR, NAME; + /// The source tokens. + final Token dollarToken, nameToken; - VariableContext(this.DOLLAR, this.NAME); + VariableContext(this.dollarToken, this.nameToken); - String get name => NAME.text; + /// The [String] value of the [nameToken]. + String get name => nameToken.text; + + /// Use [dollarToken] instead. + @deprecated + Token get DOLLAR => dollarToken; + + /// Use [nameToken] instead. + @deprecated + Token get NAME => nameToken; @override - FileSpan get span => DOLLAR.span.expand(NAME.span); + FileSpan get span => dollarToken.span.expand(nameToken.span); @override Object computeValue(Map variables) => variables[name]; - // FileSpan(DOLLAR?.span?.start, NAME?.span?.end, toSource()); }