pedantic: ast/directive.dart
This commit is contained in:
parent
a1ce812088
commit
5567b07a9b
1 changed files with 27 additions and 8 deletions
|
@ -4,28 +4,47 @@ import 'argument.dart';
|
||||||
import 'input_value.dart';
|
import 'input_value.dart';
|
||||||
import 'node.dart';
|
import 'node.dart';
|
||||||
|
|
||||||
|
/// A GraphQL directive, which may or may not have runtime semantics.
|
||||||
class DirectiveContext extends Node {
|
class DirectiveContext extends Node {
|
||||||
final Token ARROBA, NAME, COLON, LPAREN, RPAREN;
|
/// The source tokens.
|
||||||
|
final Token arroba, name, colon, lParen, rParen;
|
||||||
|
/// The argument being passed as the directive.
|
||||||
final ArgumentContext argument;
|
final ArgumentContext argument;
|
||||||
|
/// The (optional) value being passed with the directive.
|
||||||
final InputValueContext value;
|
final InputValueContext value;
|
||||||
|
|
||||||
DirectiveContext(this.ARROBA, this.NAME, this.COLON, this.LPAREN, this.RPAREN,
|
DirectiveContext(this.arroba, this.name, this.colon, this.lParen, this.rParen,
|
||||||
this.argument, this.value) {
|
this.argument, this.value) {
|
||||||
assert(NAME != null);
|
assert(name != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Use [value] instead.
|
/// Use [value] instead.
|
||||||
@deprecated
|
@deprecated
|
||||||
InputValueContext get valueOrVariable => value;
|
InputValueContext get valueOrVariable => value;
|
||||||
|
|
||||||
|
@deprecated
|
||||||
|
Token get ARROBA => arroba;
|
||||||
|
|
||||||
|
@deprecated
|
||||||
|
Token get NAME => name;
|
||||||
|
|
||||||
|
@deprecated
|
||||||
|
Token get COLON => colon;
|
||||||
|
|
||||||
|
@deprecated
|
||||||
|
Token get LPAREN => lParen;
|
||||||
|
|
||||||
|
@deprecated
|
||||||
|
Token get RPAREN => rParen;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FileSpan get span {
|
FileSpan get span {
|
||||||
var out = ARROBA.span.expand(NAME.span);
|
var out = arroba.span.expand(name.span);
|
||||||
|
|
||||||
if (COLON != null) {
|
if (colon != null) {
|
||||||
out = out.expand(COLON.span).expand(value.span);
|
out = out.expand(colon.span).expand(value.span);
|
||||||
} else if (LPAREN != null) {
|
} else if (lParen != null) {
|
||||||
out = out.expand(LPAREN.span).expand(argument.span).expand(RPAREN.span);
|
out = out.expand(lParen.span).expand(argument.span).expand(rParen.span);
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
|
Loading…
Reference in a new issue