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

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

Issue 1950243002: Do not evaluate on-demand to prevent breaking the deferred loading task (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: also run dartfmt 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 f5eac4a616761f00447706e87459e37312dca350..e45cc79e84e776a198cfefc2d17ca3535b97bee6 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -1475,8 +1475,12 @@ class JavaScriptBackend extends Backend {
if (kind.category == ElementCategory.VARIABLE) {
VariableElement variableElement = element;
ConstantExpression constant = variableElement.constant;
- if (constant != null) {
- ConstantValue initialValue = constants.getConstantValue(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) {
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