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

Unified Diff: sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart

Issue 558633002: Mark [this] as exposed if generative constructor contains function expression. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: minor fix to test Created 6 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 | « no previous file | tests/language/regress_20840_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart
diff --git a/sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart b/sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart
index 758d6d4004dbe2064ddfc00769bd9443cf7672ed..41914729f246c3a1bd40978298c09e1b8ddce486 100644
--- a/sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart
+++ b/sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart
@@ -596,6 +596,11 @@ class SimpleTypeInferrerVisitor<T>
}
T visitFunctionExpression(ast.FunctionExpression node) {
+ // We loose track of [this] in closures (see issue 20840). To be on
+ // the safe side, we mark [this] as exposed here. We could do better by
+ // analyzing the closure.
+ // TODO(herhut): Analyze whether closure exposes this.
+ isThisExposed = true;
LocalFunctionElement element = elements.getFunctionDefinition(node);
// We don't put the closure in the work queue of the
// inferrer, because it will share information with its enclosing
« no previous file with comments | « no previous file | tests/language/regress_20840_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698