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

Unified Diff: lib/compiler/implementation/dart_backend/placeholder_collector.dart

Issue 10875009: [dart2dart] Fix type variables for interfaces and default classes if they are in different libs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/dart_backend/placeholder_collector.dart
diff --git a/lib/compiler/implementation/dart_backend/placeholder_collector.dart b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
index a95f1b5b64ebe35e17d9476c1223c3ce3c6c8e47..31fa905f98e0ea3b5837c86ff938740de6b3f339 100644
--- a/lib/compiler/implementation/dart_backend/placeholder_collector.dart
+++ b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
@@ -388,6 +388,15 @@ class PlaceholderCollector extends AbstractVisitor {
visitTypeVariable(TypeVariable node) {
assert(currentElement is TypedefElement || currentElement is ClassElement);
+ // Hack for case when interface and default class are in different
+ // libraries, try to resolve type variable to default class type arg.
+ // Example:
+ // lib1: interface I<K> default C<K> {...}
+ // lib2: class C<K> {...}
+ if (currentElement is ClassElement
+ && (currentElement as ClassElement).defaultClass !== null) {
+ currentElement = (currentElement as ClassElement).defaultClass.element;
+ }
// Another poor man type resolution.
// Find this variable in current element type parameters.
for (Type type in currentElement.typeVariables) {
« no previous file with comments | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698