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

Unified Diff: pkg/compiler/lib/src/elements/modelx.dart

Issue 1936463002: Fix invariant breakage on erroneous constant variables. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 | « pkg/compiler/lib/src/constants/expressions.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/elements/modelx.dart
diff --git a/pkg/compiler/lib/src/elements/modelx.dart b/pkg/compiler/lib/src/elements/modelx.dart
index 3a1e981f5b85a870f330bb945e24f3e01b9ed29d..3c2fceef7e2276f3f67482a4b37eda44d41c1e12 100644
--- a/pkg/compiler/lib/src/elements/modelx.dart
+++ b/pkg/compiler/lib/src/elements/modelx.dart
@@ -1408,11 +1408,17 @@ abstract class ConstantVariableMixin implements VariableElement {
originVariable.constant = value;
return;
}
+ if (constantCache != null &&
+ constantCache.kind == ConstantExpressionKind.ERRONEOUS) {
+ // TODO(johnniwinther): Find out why we sometimes compute a non-erroneous
+ // constant for a variable already known to be erroneous.
+ return;
+ }
assert(invariant(this, constantCache == null || constantCache == value,
message: "Constant has already been computed for $this. "
"Existing constant: "
- "${constantCache != null ? constantCache.toDartText() : ''}, "
- "New constant: ${value != null ? value.toDartText() : ''}."));
+ "${constantCache != null ? constantCache.toStructuredText() : ''}, "
+ "New constant: ${value != null ? value.toStructuredText() : ''}."));
constantCache = value;
}
}
« no previous file with comments | « pkg/compiler/lib/src/constants/expressions.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698