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

Unified Diff: sdk/lib/_internal/compiler/implementation/types/type_graph_inferrer.dart

Issue 24211003: Let the inferrer know that lazy variables can also be null incase their initializer throws. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 | « sdk/lib/_internal/compiler/implementation/tree/nodes.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/types/type_graph_inferrer.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/types/type_graph_inferrer.dart (revision 27658)
+++ sdk/lib/_internal/compiler/implementation/types/type_graph_inferrer.dart (working copy)
@@ -1022,6 +1022,17 @@
} else {
recordTypeOfNonFinalField(node, element, type, null);
}
+ if (Elements.isStaticOrTopLevelField(element)
+ && node.asSendSet() != null
+ && !element.modifiers.isConst()) {
+ var argument = node.asSendSet().arguments.head;
+ // TODO(13429): We could do better here by using the
+ // constant handler to figure out if it's a lazy field or not.
+ if (argument.asSend() != null
+ || (argument.asNewExpression() != null && !argument.isConst())) {
+ recordType(element, types.nullType);
+ }
+ }
} else {
recordReturnType(element, type);
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/tree/nodes.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698