pedantic: ast/field_name.dart

This commit is contained in:
Tobe O 2019-08-07 22:39:29 -04:00
parent 5567b07a9b
commit 5182ff0bf2

View file

@ -3,16 +3,25 @@ import '../token.dart';
import 'alias.dart'; import 'alias.dart';
import 'node.dart'; import 'node.dart';
/// The name of a GraphQL [FieldContext], which may or may not be [alias]ed.
class FieldNameContext extends Node { class FieldNameContext extends Node {
final Token NAME; /// The source token.
final Token nameToken;
/// An (optional) alias for the field.
final AliasContext alias; final AliasContext alias;
FieldNameContext(this.NAME, [this.alias]) { FieldNameContext(this.nameToken, [this.alias]) {
assert(NAME != null || alias != null); 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 @override
FileSpan get span => alias?.span ?? NAME.span; FileSpan get span => alias?.span ?? nameToken.span;
} }