Index: pkg/compiler/lib/src/constants/expressions.dart |
diff --git a/pkg/compiler/lib/src/constants/expressions.dart b/pkg/compiler/lib/src/constants/expressions.dart |
index 17f333ac785d6f95de149677e97d265053ccd50e..1bcf8e3ba5578253b586ca02bb9fc8a348b2b5ee 100644 |
--- a/pkg/compiler/lib/src/constants/expressions.dart |
+++ b/pkg/compiler/lib/src/constants/expressions.dart |
@@ -41,6 +41,7 @@ enum ConstantExpressionKind { |
STRING_FROM_ENVIRONMENT, |
STRING_LENGTH, |
SYMBOL, |
+ SYNTHETIC, |
TYPE, |
UNARY, |
VARIABLE, |
@@ -334,6 +335,35 @@ class ErroneousConstantExpression extends ConstantExpression { |
bool _equals(ErroneousConstantExpression other) => true; |
} |
+// TODO(johnniwinther): Avoid the need for this class. |
+class SyntheticConstantExpression extends ConstantExpression { |
+ final SyntheticConstantValue value; |
+ |
+ SyntheticConstantExpression(this.value); |
+ |
+ @override |
+ ConstantValue evaluate(Environment environment, |
+ ConstantSystem constantSystem) { |
+ return value; |
+ } |
+ |
+ @override |
+ int _computeHashCode() => 13 * value.hashCode; |
+ |
+ accept(ConstantExpressionVisitor visitor, [context]) { |
+ throw "unsupported"; |
+ } |
+ |
+ @override |
+ bool _equals(SyntheticConstantExpression other) { |
+ return value == other.value; |
+ } |
+ |
+ ConstantExpressionKind get kind => ConstantExpressionKind.SYNTHETIC; |
+} |
+ |
+ |
+ |
/// A boolean, int, double, string, or null constant. |
abstract class PrimitiveConstantExpression extends ConstantExpression { |
/// The primitive value of this contant expression. |