Update DirectiveContext

This commit is contained in:
Tobe O 2019-08-07 21:46:38 -04:00
parent 3383e522b6
commit b26732d804

View file

@ -1,25 +1,29 @@
import 'package:source_span/source_span.dart';
import '../token.dart'; import '../token.dart';
import 'argument.dart'; import 'argument.dart';
import 'input_value.dart';
import 'node.dart'; import 'node.dart';
import 'package:source_span/source_span.dart';
import 'value_or_variable.dart';
class DirectiveContext extends Node { class DirectiveContext extends Node {
final Token ARROBA, NAME, COLON, LPAREN, RPAREN; final Token ARROBA, NAME, COLON, LPAREN, RPAREN;
final ArgumentContext argument; final ArgumentContext argument;
final ValueOrVariableContext valueOrVariable; 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.valueOrVariable) { this.argument, this.value) {
assert(NAME != null); assert(NAME != null);
} }
/// Use [value] instead.
@deprecated
InputValueContext get valueOrVariable => value;
@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(valueOrVariable.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);
} }