Index: pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart |
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart |
index 62a9efd65097fdbb28b463195832d71b25fa1abc..1baa388c4f9d1c473a6b7f7920ae65a537b9658e 100644 |
--- a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart |
+++ b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart |
@@ -853,9 +853,13 @@ class TypeGraphInferrerEngine |
// For non-container types, the constant handler does |
// constant folding that could give more precise results. |
ConstantExpression constant = fieldElement.constant; |
- if (constant != null) { |
- ConstantValue value = |
- compiler.backend.constants.getConstantValue(constant); |
+ // TODO(johnniwinther): ensure `value` is not null. Note that |
+ // calling `evaluate` in getConstantValue may trigger issues for |
+ // deferred loading (dartbug.com/26406). |
+ ConstantValue value = constant == null |
+ ? null |
+ : compiler.backend.constants.getConstantValue(constant); |
+ if (value != null) { |
if (value.isFunction) { |
FunctionConstantValue functionConstant = value; |
type = types.allocateClosure(node, functionConstant.element); |