OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 package com.google.dart.compiler.resolver; | 5 package com.google.dart.compiler.resolver; |
6 | 6 |
7 import com.google.dart.compiler.ErrorCode; | 7 import com.google.dart.compiler.ErrorCode; |
8 import com.google.dart.compiler.ast.DartCatchBlock; | 8 import com.google.dart.compiler.ast.DartCatchBlock; |
9 import com.google.dart.compiler.ast.DartFunction; | 9 import com.google.dart.compiler.ast.DartFunction; |
10 import com.google.dart.compiler.ast.DartFunctionTypeAlias; | 10 import com.google.dart.compiler.ast.DartFunctionTypeAlias; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // The purpose of this to find generic types and make sure they are bound to
object. | 65 // The purpose of this to find generic types and make sure they are bound to
object. |
66 DartTypeNode returnNode = node.getReturnTypeNode(); | 66 DartTypeNode returnNode = node.getReturnTypeNode(); |
67 if (returnNode != null) { | 67 if (returnNode != null) { |
68 bindReturnGenerics(returnNode); | 68 bindReturnGenerics(returnNode); |
69 } | 69 } |
70 FunctionAliasElement funcAlias = node.getSymbol(); | 70 FunctionAliasElement funcAlias = node.getSymbol(); |
71 for (Type type : funcAlias.getTypeParameters()) { | 71 for (Type type : funcAlias.getTypeParameters()) { |
72 TypeVariableElement typeVar = (TypeVariableElement) type.getElement(); | 72 TypeVariableElement typeVar = (TypeVariableElement) type.getElement(); |
73 getContext().getScope().declareElement(typeVar.getName(), typeVar); | 73 getContext().getScope().declareElement(typeVar.getName(), typeVar); |
74 } | 74 } |
75 for (DartTypeParameter param : node.getTypeParameters()) { | |
76 param.accept(this); | |
77 } | |
78 return null; | 75 return null; |
79 } | 76 } |
80 | 77 |
81 void bindTypeVariable(TypeVariableElement variable) { | 78 void bindTypeVariable(TypeVariableElement variable) { |
82 DartTypeParameter typeParameterNode = (DartTypeParameter) variable.getNode()
; | 79 DartTypeParameter typeParameterNode = (DartTypeParameter) variable.getNode()
; |
83 DartTypeNode boundNode = typeParameterNode.getBound(); | 80 DartTypeNode boundNode = typeParameterNode.getBound(); |
84 Type bound; | 81 Type bound; |
85 if (boundNode != null) { | 82 if (boundNode != null) { |
86 bound = getContext().resolveType(boundNode, true, isFactoryContext(), Reso
lverErrorCode.NO_SUCH_TYPE); | 83 bound = getContext().resolveType(boundNode, true, isFactoryContext(), Reso
lverErrorCode.NO_SUCH_TYPE); |
87 boundNode.setType(bound); | 84 boundNode.setType(bound); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 return null; | 148 return null; |
152 } | 149 } |
153 node.setSymbol(element); | 150 node.setSymbol(element); |
154 return element; | 151 return element; |
155 } | 152 } |
156 | 153 |
157 CoreTypeProvider getTypeProvider() { | 154 CoreTypeProvider getTypeProvider() { |
158 return typeProvider; | 155 return typeProvider; |
159 } | 156 } |
160 } | 157 } |
OLD | NEW |