Index: sdk/lib/_internal/compiler/implementation/world.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/world.dart b/sdk/lib/_internal/compiler/implementation/world.dart |
index 31ad44c8188955c7db9cb861ed95862c196418fb..dcf1b5e0b587a53c5c0c637391dc1719aa701202 100644 |
--- a/sdk/lib/_internal/compiler/implementation/world.dart |
+++ b/sdk/lib/_internal/compiler/implementation/world.dart |
@@ -130,9 +130,28 @@ class World { |
if (!itf.isRaw) { |
potentiallyAddForRti(itf.element); |
} |
- } else if (type.kind == TypeKind.TYPE_VARIABLE) { |
- TypeVariableElement variable = type.element; |
- potentiallyAddForRti(variable.enclosingElement); |
+ } else { |
+ TypeVariableType typeVariable = type.typeVariableOccurrence; |
+ if (typeVariable != null) { |
+ TypeVariableElement variable = typeVariable.element; |
+ potentiallyAddForRti(variable.enclosingElement); |
ngeoffray
2013/03/13 09:30:46
Why wasn't the previous code for type variable goo
Johnni Winther
2013/03/22 07:30:24
This code handles both types [:T:] and [:void f(T
|
+ } else if (type.kind == TypeKind.FUNCTION) { |
+ compiler.resolverWorld.closurizedMembers.forEach((Element member) { |
+ DartType memberType = member.computeType(compiler); |
+ typeVariable = memberType.typeVariableOccurrence; |
+ if (typeVariable != null && |
+ compiler.types.isPotentialSubtype(memberType, type)) { |
+ TypeVariableElement variable = typeVariable.element; |
+ potentiallyAddForRti(variable.enclosingElement); |
+ } |
+ }); |
+ compiler.resolverWorld.callMethods.forEach((Element member) { |
+ DartType memberType = member.computeType(compiler); |
+ if (compiler.types.isPotentialSubtype(memberType, type)) { |
+ potentiallyAddForRti(member.getEnclosingClass()); |
+ } |
+ }); |
+ } |
} |
}); |
// Add the classes that need RTI because they use a type variable as |