Chromium Code Reviews| 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 c23ebed30acaf49ae70079d0953d7a8287c10afa..1f697c8f190f493d071f1a5eb378e4ca304d6272 100644 |
| --- a/lib/compiler/implementation/dart_backend/placeholder_collector.dart |
| +++ b/lib/compiler/implementation/dart_backend/placeholder_collector.dart |
| @@ -358,12 +358,17 @@ class PlaceholderCollector extends AbstractVisitor { |
| visitTypeAnnotation(TypeAnnotation node) { |
| // Poor man generic variables resolution. |
| // TODO(antonm): get rid of it once resolver can deal with it. |
| - if (isPlainTypeName(node) && currentElement is TypeDeclarationElement) { |
| + TypeDeclarationElement typeDeclarationElement; |
| + if (currentElement is TypeDeclarationElement) { |
| + typeDeclarationElement = currentElement; |
| + } else { |
| + typeDeclarationElement = currentElement.getEnclosingClass(); |
| + } |
| + if (typeDeclarationElement !== null && isPlainTypeName(node)) { |
| SourceString name = node.typeName.asIdentifier().source; |
| - TypeDeclarationElement typeElement = currentElement; |
| - for (TypeVariableType parameter in typeElement.typeVariables) { |
| + for (TypeVariableType parameter in typeDeclarationElement.typeVariables) { |
| if (parameter.name == name) { |
| - // type annotation matches one of parameters, shouldn't be renamed. |
| + makeTypePlaceholder(node, parameter); |
| return; |
| } |
| } |
| @@ -442,6 +447,16 @@ class PlaceholderCollector extends AbstractVisitor { |
| assert(currentElement is ClassElement); |
| makeElementPlaceholder(node.name, currentElement); |
| node.visitChildren(this); |
|
Roman
2012/08/22 08:32:07
probably my last change in ClassNode affects 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. |