pedantic: typecontext
This commit is contained in:
parent
4ec6077802
commit
a43550c13f
1 changed files with 15 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue