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..8ca5d484533e0f7ca4d80f6789b5a5e0bfd1f9cd 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, |
+ 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); |
+ } |
+ } |
} |