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

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

Issue 267153002: Support general handling of type variables by substituting types into the current context. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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/dart_types.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart_types.dart b/sdk/lib/_internal/compiler/implementation/dart_types.dart
index 17794f9d6e79c8e6bddda99321484c5ffbf00220..c59029c55ed28e210f9e4a02b1db97481b48c87a 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_types.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_types.dart
@@ -485,14 +485,12 @@ class InterfaceType extends GenericType {
DartType asInstanceOf(ClassElement other) {
other = other.declaration;
if (element == other) return this;
- for (InterfaceType supertype in element.allSupertypes) {
- ClassElement superclass = supertype.element;
- if (superclass == other) {
- Link<DartType> arguments = Types.substTypes(supertype.typeArguments,
- typeArguments,
- element.typeVariables);
- return new InterfaceType(superclass, arguments);
- }
+ InterfaceType supertype = element.asInstanceOf(other);
+ if (supertype != null) {
+ Link<DartType> arguments = Types.substTypes(supertype.typeArguments,
+ typeArguments,
+ element.typeVariables);
+ return new InterfaceType(supertype.element, arguments);
}
return null;
}

Powered by Google App Engine
This is Rietveld 408576698