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

Unified Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1955403002: Skip spurious constants in deferred computation. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 7 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
Index: pkg/compiler/lib/src/js_backend/backend.dart
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index e45cc79e84e776a198cfefc2d17ca3535b97bee6..5e0105b0d6213ba1887573fcfdadcfea45fe090f 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -1475,12 +1475,11 @@ class JavaScriptBackend extends Backend {
if (kind.category == ElementCategory.VARIABLE) {
VariableElement variableElement = element;
ConstantExpression constant = variableElement.constant;
- // TODO(johnniwinther): ensure `initialValue` is not null. Note that
- // calling `evaluate` in getConstantValue may trigger issues for deferred
- // loading (dartbug.com/26406).
- ConstantValue initialValue =
- constant == null ? null : constants.getConstantValue(constant);
- if (initialValue != null) {
+ if (constant != null) {
+ ConstantValue initialValue = constants.getConstantValue(constant);
+ assert(invariant(variableElement, initialValue != null,
+ message: "Constant expression without value: "
+ "${constant.toStructuredText()}."));
registerCompileTimeConstant(initialValue, work.registry);
addCompileTimeConstantForEmission(initialValue);
// We don't need to generate code for static or top-level

Powered by Google App Engine
This is Rietveld 408576698