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

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

Issue 12334070: Support runtime check of function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Register dependency 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
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

Powered by Google App Engine
This is Rietveld 408576698