From b245dde4fbcdd5f77e9e41282aff8f0ca0038256 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 7 Aug 2019 23:17:05 -0400 Subject: [PATCH] pedantic: var def --- .../src/language/ast/variable_definition.dart | 16 ++++++++++++++-- .../src/language/ast/variable_definitions.dart | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/graphql_parser/lib/src/language/ast/variable_definition.dart b/graphql_parser/lib/src/language/ast/variable_definition.dart index 9585bfd1..7432798a 100644 --- a/graphql_parser/lib/src/language/ast/variable_definition.dart +++ b/graphql_parser/lib/src/language/ast/variable_definition.dart @@ -5,15 +5,27 @@ import 'package:source_span/source_span.dart'; import 'type.dart'; import 'variable.dart'; +/// A single variable definition. class VariableDefinitionContext extends Node { - final Token COLON; + /// The source token. + final Token colonToken; + + /// The declared variable. final VariableContext variable; + + /// The type of the variable. final TypeContext type; + + /// The default value of the variable. final DefaultValueContext defaultValue; - VariableDefinitionContext(this.variable, this.COLON, this.type, + VariableDefinitionContext(this.variable, this.colonToken, this.type, [this.defaultValue]); + /// Use [colonToken] instead. + @deprecated + Token get COLON => colonToken; + @override FileSpan get span => variable.span.expand(defaultValue?.span ?? type.span); } diff --git a/graphql_parser/lib/src/language/ast/variable_definitions.dart b/graphql_parser/lib/src/language/ast/variable_definitions.dart index fd1fbafd..ddc4405f 100644 --- a/graphql_parser/lib/src/language/ast/variable_definitions.dart +++ b/graphql_parser/lib/src/language/ast/variable_definitions.dart @@ -5,6 +5,7 @@ import 'variable_definition.dart'; /// A set of variable definitions in a GraphQL operation. class VariableDefinitionsContext extends Node { + /// The source tokens. final Token lParenToken, rParenToken; /// The variables defined in this node.