Chromium Code Reviews| Index: compiler/java/com/google/dart/compiler/resolver/SupertypeResolver.java |
| diff --git a/compiler/java/com/google/dart/compiler/resolver/SupertypeResolver.java b/compiler/java/com/google/dart/compiler/resolver/SupertypeResolver.java |
| index 0037be543d17bfefc94822b13fd52d9c382bc4a6..a77315ff24ea4f2318595ca8d41ae4fecdf8a45b 100644 |
| --- a/compiler/java/com/google/dart/compiler/resolver/SupertypeResolver.java |
| +++ b/compiler/java/com/google/dart/compiler/resolver/SupertypeResolver.java |
| @@ -14,6 +14,8 @@ import com.google.dart.compiler.ast.DartUnit; |
| import com.google.dart.compiler.type.InterfaceType; |
| import com.google.dart.compiler.type.Type; |
| +import java.util.List; |
| + |
| /** |
| * Resolves the super class, interfaces, default implementation and |
| * bounds type parameters of classes in a DartUnit. |
| @@ -79,33 +81,38 @@ public class SupertypeResolver { |
| Elements.addInterface(classElement, classContext.resolveInterface(cls, false, false)); |
| } |
| } |
| - |
| - for (Type typeParameter : classElement.getTypeParameters()) { |
| - TypeVariableElement variable = (TypeVariableElement) typeParameter.getElement(); |
| - DartTypeParameter typeParameterNode = (DartTypeParameter) variable.getNode(); |
| - DartTypeNode boundNode = typeParameterNode.getBound(); |
| - Type bound; |
| - if (boundNode != null) { |
| - bound = |
| - classContext.resolveType( |
| - boundNode, |
| - false, |
| - false, |
| - ResolverErrorCode.NO_SUCH_TYPE); |
| - boundNode.setType(bound); |
| - } else { |
| - bound = typeProvider.getObjectType(); |
| - } |
| - variable.setBound(bound); |
| - } |
| - |
| + setBoundsOnTypeParameters(classElement.getTypeParameters(), classContext); |
| return null; |
| } |
| @Override |
| public Void visitFunctionTypeAlias(DartFunctionTypeAlias node) { |
| + ResolutionContext resolutionContext = topLevelContext.extend(node.getSymbol()); |
| Elements.addInterface(node.getSymbol(), typeProvider.getFunctionType()); |
| + setBoundsOnTypeParameters(node.getSymbol().getTypeParameters(), resolutionContext); |
| return null; |
| } |
| } |
| + |
| + private void setBoundsOnTypeParameters(List<?extends Type> typeParameters, |
|
scheglov
2012/01/04 21:51:43
"<?extends" space missing.
zundel
2012/01/09 16:02:49
Done.
|
| + ResolutionContext resolutionContext) { |
| + for (Type typeParameter : typeParameters) { |
| + TypeVariableElement variable = (TypeVariableElement) typeParameter.getElement(); |
| + DartTypeParameter typeParameterNode = (DartTypeParameter) variable.getNode(); |
| + DartTypeNode boundNode = typeParameterNode.getBound(); |
| + Type bound; |
| + if (boundNode != null) { |
| + bound = |
| + resolutionContext.resolveType( |
| + boundNode, |
| + false, |
| + false, |
| + ResolverErrorCode.NO_SUCH_TYPE); |
| + boundNode.setType(bound); |
| + } else { |
| + bound = typeProvider.getObjectType(); |
| + } |
| + variable.setBound(bound); |
| + } |
| + } |
| } |