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 |