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

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

Issue 12210142: Implement is-checks against type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add a comment. Created 7 years, 10 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 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;

Powered by Google App Engine
This is Rietveld 408576698