Fix ValueContext
This commit is contained in:
parent
ae50e0dae7
commit
87ab0b4230
2 changed files with 8 additions and 11 deletions
|
@ -1,11 +1,10 @@
|
||||||
import 'package:source_span/source_span.dart';
|
import 'package:source_span/source_span.dart';
|
||||||
import '../token.dart';
|
import '../token.dart';
|
||||||
import 'constant.dart';
|
|
||||||
import 'input_value.dart';
|
import 'input_value.dart';
|
||||||
|
|
||||||
class ListValueContext extends ValueContext {
|
class ListValueContext extends InputValueContext {
|
||||||
final Token LBRACKET, RBRACKET;
|
final Token LBRACKET, RBRACKET;
|
||||||
final List<ValueContext> values = [];
|
final List<InputValueContext> values = [];
|
||||||
|
|
||||||
ListValueContext(this.LBRACKET, this.RBRACKET);
|
ListValueContext(this.LBRACKET, this.RBRACKET);
|
||||||
|
|
||||||
|
@ -16,5 +15,7 @@ class ListValueContext extends ValueContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List get value => values.map((v) => v.value).toList();
|
computeValue(Map<String, dynamic> variables) {
|
||||||
|
return values.map((v) => v.computeValue(variables)).toList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
import 'node.dart';
|
import 'input_value.dart';
|
||||||
|
|
||||||
abstract class ConstantContext<T> extends Node {
|
|
||||||
T get value;
|
|
||||||
T computeValue(Map<String, dynamic> variables) => value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Use [ConstantContext] instead. This class remains solely for backwards compatibility.
|
/// Use [ConstantContext] instead. This class remains solely for backwards compatibility.
|
||||||
@deprecated
|
@deprecated
|
||||||
abstract class ValueContext<T> extends ConstantContext<T> {
|
abstract class ValueContext<T> extends InputValueContext<T> {
|
||||||
T get value;
|
T get value;
|
||||||
|
T computeValue(Map<String, dynamic> variables) => value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue