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 271629bf64132666df45a3b3aba08074886ca86e..ba18905df735b4f76518da06424ee257793df1b9 100644 |
--- a/sdk/lib/_internal/compiler/implementation/world.dart |
+++ b/sdk/lib/_internal/compiler/implementation/world.dart |
@@ -53,6 +53,8 @@ class World { |
compiler.resolverWorld.instantiatedClasses.forEach(addSubtypes); |
+ compiler.backend.addBackendRtiDependencies(this); |
ngeoffray
2013/02/27 16:18:37
Explain why you're doing this, and why now.
karlklose
2013/02/28 11:37:46
Done.
|
+ |
// Find the classes that need runtime type information. Such |
// classes are: |
// (1) used in a is check with type variables, |
@@ -79,12 +81,23 @@ class World { |
} |
} |
+ Set<ClassElement> classesUsingTypeVariableTests = new Set<ClassElement>(); |
compiler.resolverWorld.isChecks.forEach((DartType type) { |
- if (type is InterfaceType) { |
+ if (type.kind == TypeKind.TYPE_VARIABLE) { |
+ TypeVariableElement variable = type.element; |
+ classesUsingTypeVariableTests.add(variable.enclosingElement); |
+ } |
+ }); |
+ compiler.resolverWorld.addImplicitChecks(classesUsingTypeVariableTests); |
+ compiler.resolverWorld.isChecks.forEach((DartType type) { |
+ if (type.kind == TypeKind.INTERFACE) { |
InterfaceType itf = type; |
if (!itf.isRaw) { |
potentiallyAddForRti(itf.element); |
} |
+ } else if (type.kind == TypeKind.TYPE_VARIABLE) { |
+ TypeVariableElement variable = type.element; |
+ potentiallyAddForRti(variable.enclosingElement); |
} |
}); |
} |
@@ -102,7 +115,6 @@ class World { |
return uses != null && !uses.isEmpty; |
} |
- |
void registerRtiDependency(Element element, Element dependency) { |
// We're not dealing with typedef for now. |
if (!element.isClass() || !dependency.isClass()) return; |