Index: compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java |
diff --git a/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java b/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java |
index 133fac6e4465660fdf5f7f91e24919a51b5a46b0..94302583c9431d37c21aafa01941ea4e2a892624 100644 |
--- a/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java |
+++ b/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java |
@@ -7,6 +7,7 @@ package com.google.dart.compiler.resolver; |
import com.google.dart.compiler.ErrorCode; |
import com.google.dart.compiler.ast.DartCatchBlock; |
import com.google.dart.compiler.ast.DartFunction; |
+import com.google.dart.compiler.ast.DartFunctionTypeAlias; |
import com.google.dart.compiler.ast.DartNode; |
import com.google.dart.compiler.ast.DartNodeTraverser; |
import com.google.dart.compiler.ast.DartParameter; |
@@ -67,6 +68,46 @@ abstract class ResolveVisitor extends DartNodeTraverser<Element> { |
return element; |
} |
+ final FunctionAliasElement resolveFunctionAlias(DartFunctionTypeAlias node) { |
+ List<TypeVariable> typeVariables = Elements.makeTypeVariables(node.getTypeParameters(), |
+ node.getSymbol()); |
+ if (typeVariables != null) { |
+ for (TypeVariable typeParameter : typeVariables) { |
+ TypeVariableElement variable = (TypeVariableElement) typeParameter.getElement(); |
+ DartTypeParameter typeParameterNode = (DartTypeParameter) variable.getNode(); |
+ DartTypeNode boundNode = typeParameterNode.getBound(); |
+ Type bound; |
+ if (boundNode != null) { |
+ bound = getContext().resolveType(boundNode, true, ResolverErrorCode.NO_SUCH_TYPE); |
+ boundNode.setType(bound); |
+ } else { |
+ bound = typeProvider.getObjectType(); |
+ } |
+ variable.setBound(bound); |
+ } |
+ } |
+ DartTypeNode returnType = node.getReturnTypeNode(); |
+ if (returnType != null) { |
+ for (DartTypeNode typeNode : returnType.getTypeArguments()) { |
zundel
2011/11/08 15:28:42
It looks to me like these two sections of this met
|
+// if (!(typeNode.getType().getElement() instanceof TypeVariableElement)) { |
+// continue;//?? |
+// } |
+ TypeVariableElement variable = (TypeVariableElement) typeNode.getType().getElement(); |
+ DartTypeParameter typeParameterNode = (DartTypeParameter) variable.getNode(); |
+ DartTypeNode boundNode = typeParameterNode.getBound(); |
+ Type bound; |
+ if (boundNode != null) { |
+ bound = getContext().resolveType(boundNode, true, ResolverErrorCode.NO_SUCH_TYPE); |
+ boundNode.setType(bound); |
+ } else { |
+ bound = typeProvider.getObjectType(); |
+ } |
+ variable.setBound(bound); |
+ } |
+ } |
+ return null; |
+ } |
+ |
abstract boolean isStaticContext(); |
@Override |