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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 17262003: Fix type variables in closures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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
Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index 75d644355eece6246ba3cb338c882e5e44d4f904..e1176aeadee91e90460be712c030e717275bb9bc 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -3253,8 +3253,15 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
} else if (member.isConstructor() ||
member.isGenerativeConstructorBody() ||
member.isField()) {
- // The type variable is stored in a parameter of the method.
- return localsHandler.readLocal(type.element);
+ if (isClosure && !member.isField()) {
+ // The type variable is stored on the object and needs to be accessed
+ // using the this-reference in the closure.
+ return readTypeVariable(member.getEnclosingClass(),
+ type.element);
+ } else {
+ // The type variable is stored in a parameter of the method.
+ return localsHandler.readLocal(type.element);
+ }
} else if (member.isInstanceMember()) {
// The type variable is stored on the object.
return readTypeVariable(member.getEnclosingClass(),

Powered by Google App Engine
This is Rietveld 408576698