pedantic: ast/boolean_value.dart

This commit is contained in:
Tobe O 2019-08-07 22:34:23 -04:00
parent 5f178c4a13
commit a1ce812088

View file

@ -2,18 +2,26 @@ import 'package:source_span/source_span.dart';
import 'input_value.dart'; import 'input_value.dart';
import '../token.dart'; import '../token.dart';
/// A GraphQL boolean value literal.
class BooleanValueContext extends InputValueContext<bool> { class BooleanValueContext extends InputValueContext<bool> {
bool _valueCache; bool _valueCache;
final Token BOOLEAN;
BooleanValueContext(this.BOOLEAN) { /// The source token.
assert(BOOLEAN?.text == 'true' || BOOLEAN?.text == 'false'); final Token boolean;
BooleanValueContext(this.boolean) {
assert(boolean?.text == 'true' || boolean?.text == 'false');
} }
bool get booleanValue => _valueCache ??= BOOLEAN.text == 'true'; /// The [bool] value of this literal.
bool get booleanValue => _valueCache ??= boolean.text == 'true';
/// Use [boolean] instead.
@deprecated
Token get BOOLEAN => boolean;
@override @override
FileSpan get span => BOOLEAN.span; FileSpan get span => boolean.span;
@override @override
bool computeValue(Map<String, dynamic> variables) => booleanValue; bool computeValue(Map<String, dynamic> variables) => booleanValue;