OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import com.google.common.annotations.VisibleForTesting; | 6 import com.google.common.annotations.VisibleForTesting; |
7 import com.google.dart.compiler.DartCompilationError; | 7 import com.google.dart.compiler.DartCompilationError; |
8 import com.google.dart.compiler.DartCompilerContext; | 8 import com.google.dart.compiler.DartCompilerContext; |
9 import com.google.dart.compiler.ErrorCode; | 9 import com.google.dart.compiler.ErrorCode; |
10 import com.google.dart.compiler.ast.DartFunctionExpression; | 10 import com.google.dart.compiler.ast.DartFunctionExpression; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 259 } |
260 onError(identifier, errorCode, identifier); | 260 onError(identifier, errorCode, identifier); |
261 return typeProvider.getDynamicType(); | 261 return typeProvider.getDynamicType(); |
262 } | 262 } |
263 | 263 |
264 InterfaceType instantiateParameterizedType(ClassElement element, DartNode node
, | 264 InterfaceType instantiateParameterizedType(ClassElement element, DartNode node
, |
265 List<DartTypeNode> typeArgumentNode
s, | 265 List<DartTypeNode> typeArgumentNode
s, |
266 boolean isStatic, | 266 boolean isStatic, |
267 boolean isFactory, | 267 boolean isFactory, |
268 ErrorCode errorCode) { | 268 ErrorCode errorCode) { |
269 List<? extends Type> typeParameters = element.getTypeParameters(); | 269 List<Type> typeParameters = element.getTypeParameters(); |
270 | |
271 Type[] typeArguments; | 270 Type[] typeArguments; |
272 if (typeArgumentNodes == null || typeArgumentNodes.size() != typeParameters.
size()) { | 271 if (typeArgumentNodes == null || typeArgumentNodes.size() != typeParameters.
size()) { |
273 typeArguments = new Type[typeParameters.size()]; | 272 typeArguments = new Type[typeParameters.size()]; |
274 for (int i = 0; i < typeArguments.length; i++) { | 273 for (int i = 0; i < typeArguments.length; i++) { |
275 typeArguments[i] = typeProvider.getDynamicType(); | 274 typeArguments[i] = typeProvider.getDynamicType(); |
276 } | 275 } |
277 if (typeArgumentNodes != null && typeArgumentNodes.size() > 0) { | 276 if (typeArgumentNodes != null && typeArgumentNodes.size() > 0) { |
278 ErrorCode wrongNumberErrorCode = | 277 ErrorCode wrongNumberErrorCode = |
279 errorCode instanceof ResolverErrorCode | 278 errorCode instanceof ResolverErrorCode |
280 ? ResolverErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS | 279 ? ResolverErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 return null; | 372 return null; |
374 } | 373 } |
375 | 374 |
376 @Override | 375 @Override |
377 public Element visitIdentifier(DartIdentifier node) { | 376 public Element visitIdentifier(DartIdentifier node) { |
378 String name = node.getTargetName(); | 377 String name = node.getTargetName(); |
379 return scope.findElement(scope.getLibrary(), name); | 378 return scope.findElement(scope.getLibrary(), name); |
380 } | 379 } |
381 } | 380 } |
382 } | 381 } |
OLD | NEW |