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

Unified Diff: pkg/compiler/lib/src/inferrer/type_graph_inferrer.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
« no previous file with comments | « pkg/compiler/lib/src/deferred_load.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « pkg/compiler/lib/src/deferred_load.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698