From a43550c13f88cfe93a05cb171e46e94d3179ef30 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 7 Aug 2019 23:04:48 -0400 Subject: [PATCH] pedantic: typecontext --- graphql_parser/lib/src/language/ast/type.dart | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/graphql_parser/lib/src/language/ast/type.dart b/graphql_parser/lib/src/language/ast/type.dart index 48b4bcda..d82a97e3 100644 --- a/graphql_parser/lib/src/language/ast/type.dart +++ b/graphql_parser/lib/src/language/ast/type.dart @@ -4,20 +4,31 @@ import 'list_type.dart'; import 'node.dart'; import 'type_name.dart'; +/// A GraphQL type node. class TypeContext extends Node { - final Token EXCLAMATION; + /// A source token, present in a nullable type literal. + final Token exclamationToken; + + /// The name of the referenced type. final TypeNameContext typeName; + + /// A list type that is being referenced. final ListTypeContext listType; - bool get isNullable => EXCLAMATION == null; + /// Whether the type is nullable. + bool get isNullable => exclamationToken == null; - TypeContext(this.typeName, this.listType, [this.EXCLAMATION]) { + TypeContext(this.typeName, this.listType, [this.exclamationToken]) { assert(typeName != null || listType != null); } + /// Use [exclamationToken] instead. + @deprecated + Token get EXCLAMATION => exclamationToken; + @override FileSpan get span { var out = typeName?.span ?? listType.span; - return EXCLAMATION != null ? out.expand(EXCLAMATION.span) : out; + return exclamationToken != null ? out.expand(exclamationToken.span) : out; } }