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

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

Issue 13527003: Make `this` available in closures if a type variable is used as expression. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add null check and test status for dart2dart Created 7 years, 9 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_type_variable_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 dbfd5b8c6bdec51f25fbbf8d339420c8504a9780..aa17a0079bdad5ed78f786bf586684ab1a367b41 100644
--- a/sdk/lib/_internal/compiler/implementation/closure.dart
+++ b/sdk/lib/_internal/compiler/implementation/closure.dart
@@ -405,6 +405,11 @@ class ClosureTranslator extends Visitor {
visitIdentifier(Identifier node) {
if (node.isThis()) {
useLocal(closureData.thisElement);
+ } else {
+ Element element = elements[node];
+ if (element != null && element.kind == ElementKind.TYPE_VARIABLE) {
+ useLocal(closureData.thisElement);
+ }
}
node.visitChildren(this);
}
« no previous file with comments | « no previous file | tests/language/closure_type_variable_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698