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

Unified Diff: sdk/lib/_internal/compiler/implementation/closure.dart

Issue 308283003: Fix crash when a closure self-referenced in a try. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | « no previous file | tests/language/closure_self_reference_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/closure.dart
diff --git a/sdk/lib/_internal/compiler/implementation/closure.dart b/sdk/lib/_internal/compiler/implementation/closure.dart
index a7ae252e14c1252f748d6829fdff09c558013f59..388eb2c14ccba45d7620db35e61a053779132ced 100644
--- a/sdk/lib/_internal/compiler/implementation/closure.dart
+++ b/sdk/lib/_internal/compiler/implementation/closure.dart
@@ -454,9 +454,11 @@ class ClosureTranslator extends Visitor {
closureData.freeVariableMapping[element] == element);
closureData.freeVariableMapping[element] = element;
} else if (inTryStatement) {
- // Don't mark the this-element. This would complicate things in the
- // builder.
- if (element != closureData.thisElement) {
+ // Don't mark the this-element or a self-reference. This would complicate
+ // things in the builder.
+ // Note that nested (named) functions are immutable.
+ if (element != closureData.thisElement &&
+ element != closureData.closureElement) {
// TODO(ngeoffray): only do this if the variable is mutated.
closureData.usedVariablesInTry.add(element);
}
« no previous file with comments | « no previous file | tests/language/closure_self_reference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698