Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(993)

Unified Diff: pkg/compiler/lib/src/constants/expressions.dart

Issue 1153243003: dart2js: Use frequency of occurence to sort metadata indices. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Addressed sra's comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/constants/values.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | pkg/compiler/lib/src/constants/values.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698