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

Unified Diff: pkg/compiler/lib/src/inferrer/builder.dart

Issue 2799763003: Fix for type analysis bug in constructor with early return (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | pkg/compiler/lib/src/inferrer/locals_handler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/inferrer/builder.dart
diff --git a/pkg/compiler/lib/src/inferrer/builder.dart b/pkg/compiler/lib/src/inferrer/builder.dart
index ea4b8c833eb25a18e30f08c96f42de0929d8b7bd..afbd8be42b4372525414a34d81f3ca1ae4cb6822 100644
--- a/pkg/compiler/lib/src/inferrer/builder.dart
+++ b/pkg/compiler/lib/src/inferrer/builder.dart
@@ -131,6 +131,12 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
}
}
+ void initializationIsIndefinite() {
+ if (analyzedElement.isGenerativeConstructor) {
+ locals.fieldScope.isIndefinite = true;
+ }
+ }
+
DiagnosticReporter get reporter => compiler.reporter;
ClosedWorld get closedWorld => inferrer.closedWorld;
@@ -710,6 +716,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
TypeInformation visitTryStatement(ast.TryStatement node) {
LocalsHandler saved = locals;
locals = new LocalsHandler.from(locals, node, useOtherTryBlock: false);
+ initializationIsIndefinite();
visit(node.tryBlock);
saved.mergeDiamondFlow(locals, null);
locals = saved;
@@ -2863,6 +2870,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
recordReturnType(
expression == null ? types.nullType : expression.accept(this));
locals.seenReturnOrThrow = true;
+ initializationIsIndefinite();
return null;
}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/locals_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698