2017-01-22 23:15:53 +00:00
|
|
|
import '../token.dart';
|
2017-07-05 22:44:13 +00:00
|
|
|
import 'package:source_span/source_span.dart';
|
2017-01-22 23:15:53 +00:00
|
|
|
import 'value.dart';
|
|
|
|
|
2018-08-04 19:18:53 +00:00
|
|
|
class BooleanValueContext extends ValueContext<bool> {
|
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
|
2018-08-04 19:18:53 +00:00
|
|
|
bool get value => booleanValue;
|
2017-01-22 23:15:53 +00:00
|
|
|
|
|
|
|
@override
|
2017-07-05 22:44:13 +00:00
|
|
|
FileSpan get span => BOOLEAN.span;
|
2017-01-22 23:15:53 +00:00
|
|
|
}
|