| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library analyzer.src.generated.declaration_resolver; | 5 library analyzer.src.generated.declaration_resolver; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/dart/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| 11 import 'package:analyzer/exception/exception.dart'; | 11 import 'package:analyzer/exception/exception.dart'; |
| 12 import 'package:analyzer/src/dart/element/builder.dart'; | 12 import 'package:analyzer/src/dart/element/builder.dart'; |
| 13 import 'package:analyzer/src/dart/element/element.dart'; | 13 import 'package:analyzer/src/dart/element/element.dart'; |
| 14 import 'package:analyzer/src/dart/element/type.dart'; |
| 14 import 'package:analyzer/src/generated/resolver.dart'; | 15 import 'package:analyzer/src/generated/resolver.dart'; |
| 15 | 16 |
| 16 /** | 17 /** |
| 17 * A visitor that resolves declarations in an AST structure to already built | 18 * A visitor that resolves declarations in an AST structure to already built |
| 18 * elements. | 19 * elements. |
| 19 * | 20 * |
| 20 * The resulting AST must have everything resolved that would have been resolved | 21 * The resulting AST must have everything resolved that would have been resolved |
| 21 * by a [CompilationUnitBuilder] (that is, must be a valid [RESOLVED_UNIT1]). | 22 * by a [CompilationUnitBuilder] (that is, must be a valid [RESOLVED_UNIT1]). |
| 22 * This class must not assume that the [CompilationUnitElement] passed to it is | 23 * This class must not assume that the [CompilationUnitElement] passed to it is |
| 23 * any more complete than a [COMPILATION_UNIT_ELEMENT]. | 24 * any more complete than a [COMPILATION_UNIT_ELEMENT]. |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 super.visitTopLevelVariableDeclaration(node); | 392 super.visitTopLevelVariableDeclaration(node); |
| 392 _resolveMetadata(node, node.metadata, node.variables.variables[0].element); | 393 _resolveMetadata(node, node.metadata, node.variables.variables[0].element); |
| 393 return null; | 394 return null; |
| 394 } | 395 } |
| 395 | 396 |
| 396 @override | 397 @override |
| 397 Object visitTypeParameter(TypeParameter node) { | 398 Object visitTypeParameter(TypeParameter node) { |
| 398 if (node.parent.parent is FunctionTypedFormalParameter) { | 399 if (node.parent.parent is FunctionTypedFormalParameter) { |
| 399 // Work around dartbug.com/28515. | 400 // Work around dartbug.com/28515. |
| 400 // TODO(paulberry): remove this once dartbug.com/28515 is fixed. | 401 // TODO(paulberry): remove this once dartbug.com/28515 is fixed. |
| 401 Element element = new TypeParameterElementImpl.forNode(node.name); | 402 var element = new TypeParameterElementImpl.forNode(node.name); |
| 403 element.type = new TypeParameterTypeImpl(element); |
| 402 node.name?.staticElement = element; | 404 node.name?.staticElement = element; |
| 403 return null; | 405 return null; |
| 404 } | 406 } |
| 405 Element element = _match(node.name, _walker.getTypeParameter()); | 407 Element element = _match(node.name, _walker.getTypeParameter()); |
| 406 super.visitTypeParameter(node); | 408 super.visitTypeParameter(node); |
| 407 _resolveMetadata(node, node.metadata, element); | 409 _resolveMetadata(node, node.metadata, element); |
| 408 return null; | 410 return null; |
| 409 } | 411 } |
| 410 | 412 |
| 411 @override | 413 @override |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 class _ElementMismatchException extends AnalysisException { | 733 class _ElementMismatchException extends AnalysisException { |
| 732 /** | 734 /** |
| 733 * Creates an exception to refer to the given [compilationUnit], [element], | 735 * Creates an exception to refer to the given [compilationUnit], [element], |
| 734 * and [cause]. | 736 * and [cause]. |
| 735 */ | 737 */ |
| 736 _ElementMismatchException( | 738 _ElementMismatchException( |
| 737 CompilationUnitElement compilationUnit, Element element, | 739 CompilationUnitElement compilationUnit, Element element, |
| 738 [CaughtException cause = null]) | 740 [CaughtException cause = null]) |
| 739 : super('Element mismatch in $compilationUnit at $element', cause); | 741 : super('Element mismatch in $compilationUnit at $element', cause); |
| 740 } | 742 } |
| OLD | NEW |