2017-07-05 22:44:13 +00:00
|
|
|
import 'package:source_span/source_span.dart';
|
2019-08-08 01:45:24 +00:00
|
|
|
import 'input_value.dart';
|
|
|
|
import '../token.dart';
|
2017-01-22 23:15:53 +00:00
|
|
|
|
2019-08-08 01:45:24 +00:00
|
|
|
class BooleanValueContext extends InputValueContext<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
|
2019-08-08 01:45:24 +00:00
|
|
|
FileSpan get span => BOOLEAN.span;
|
2017-01-22 23:15:53 +00:00
|
|
|
|
|
|
|
@override
|
2019-08-08 01:45:24 +00:00
|
|
|
bool computeValue(Map<String, dynamic> variables) => booleanValue;
|
2017-01-22 23:15:53 +00:00
|
|
|
}
|