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 1baa388c4f9d1c473a6b7f7920ae65a537b9658e..1cac7aabaf32c4880406aa132b9a7b6d47371b2b 100644 |
--- a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart |
+++ b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart |
@@ -853,13 +853,12 @@ class TypeGraphInferrerEngine |
// For non-container types, the constant handler does |
// constant folding that could give more precise results. |
ConstantExpression constant = fieldElement.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 (constant != null) { |
+ ConstantValue value = |
+ compiler.backend.constants.getConstantValue(constant); |
+ assert(invariant(fieldElement, value != null, |
+ message: "Constant expression without value: " |
+ "${constant.toStructuredText()}.")); |
if (value.isFunction) { |
FunctionConstantValue functionConstant = value; |
type = types.allocateClosure(node, functionConstant.element); |