Fix ValueContext

This commit is contained in:
Tobe O 2019-08-07 21:44:25 -04:00
parent ae50e0dae7
commit 87ab0b4230
2 changed files with 8 additions and 11 deletions

View file

@ -1,11 +1,10 @@
import 'package:source_span/source_span.dart';
import '../token.dart';
import 'constant.dart';
import 'input_value.dart';
class ListValueContext extends ValueContext {
class ListValueContext extends InputValueContext {
final Token LBRACKET, RBRACKET;
final List<ValueContext> values = [];
final List<InputValueContext> values = [];
ListValueContext(this.LBRACKET, this.RBRACKET);
@ -16,5 +15,7 @@ class ListValueContext extends ValueContext {
}
@override
List get value => values.map((v) => v.value).toList();
computeValue(Map<String, dynamic> variables) {
return values.map((v) => v.computeValue(variables)).toList();
}
}

View file

@ -1,12 +1,8 @@
import 'node.dart';
abstract class ConstantContext<T> extends Node {
T get value;
T computeValue(Map<String, dynamic> variables) => value;
}
import 'input_value.dart';
/// Use [ConstantContext] instead. This class remains solely for backwards compatibility.
@deprecated
abstract class ValueContext<T> extends ConstantContext<T> {
abstract class ValueContext<T> extends InputValueContext<T> {
T get value;
T computeValue(Map<String, dynamic> variables) => value;
}