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

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: Rebased + reinserted unalias 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/elements/elements.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5a270e91213d4825f62daca7414496f62a58a75a..896d8316a7431af3e9a932f9612935e2d62cdb6b 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;
}
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698