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

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

Issue 10866017: dart2dart Fix type variables rename (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 14a2674167a5b74b88b90235c2352e09b1cd4951..44aeddecc6799d49750a5646bb1087080d366fb7 100644
--- a/lib/compiler/implementation/dart_backend/placeholder_collector.dart
+++ b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
@@ -442,16 +442,6 @@ class PlaceholderCollector extends AbstractVisitor {
assert(currentElement is ClassElement);
makeElementPlaceholder(node.name, currentElement);
node.visitChildren(this);
- if (node.typeParameters !== null) {
- // Another poor man resolution.
- final typeVariableTypes =
- new List<Type>.from(currentElement.typeVariables);
- int i = 0;
- for (TypeVariable typeVariable in node.typeParameters) {
- makeTypePlaceholder(typeVariable.name, typeVariableTypes[i]);
- i++;
- }
- }
if (node.defaultClause !== null) {
// Can't just visit class node's default clause because of the bug in the
// resolver, it just crashes when it meets type variable.
@@ -462,6 +452,19 @@ class PlaceholderCollector extends AbstractVisitor {
}
}
+ visitTypeVariable(TypeVariable node) {
Anton Muhin 2012/08/22 12:34:53 it fixes a case with typedefs too?
Roman 2012/08/22 12:38:22 Yes, there's a test for it in unparser_test. At fi
+ assert(currentElement is TypedefElement || currentElement is ClassElement);
+ // Another poor man type resolution.
+ // Find this variable in current element type parameters.
+ for (Type type in currentElement.typeVariables) {
+ if (type.name.slowToString() == node.name.source.slowToString()) {
+ makeTypePlaceholder(node.name, type);
+ break;
+ }
+ }
+ node.visitChildren(this);
+ }
+
visitTypedef(Typedef node) {
assert(currentElement is TypedefElement);
makeElementPlaceholder(node.name, currentElement);
« 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