platform/lib/src/language/ast/boolean_value.dart

24 lines
504 B
Dart
Raw Normal View History

2017-01-22 23:15:53 +00:00
import '../token.dart';
import 'package:source_span/src/span.dart';
import 'value.dart';
class BooleanValueContext extends ValueContext {
2017-07-03 15:37:35 +00:00
bool _valueCache;
2017-01-22 23:15:53 +00:00
final Token BOOLEAN;
2017-01-25 04:28:09 +00:00
BooleanValueContext(this.BOOLEAN) {
assert(BOOLEAN?.text == 'true' || BOOLEAN?.text == 'false');
}
2017-07-03 15:37:35 +00:00
bool get booleanValue => _valueCache ??= BOOLEAN.text == 'true';
@override
get value => booleanValue;
2017-01-22 23:15:53 +00:00
@override
SourceSpan get span => BOOLEAN.span;
@override
String toSource() => BOOLEAN.text;
}