| 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'; |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 379 |
| 380 @override | 380 @override |
| 381 Object visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) { | 381 Object visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) { |
| 382 super.visitTopLevelVariableDeclaration(node); | 382 super.visitTopLevelVariableDeclaration(node); |
| 383 _resolveMetadata(node, node.metadata, node.variables.variables[0].element); | 383 _resolveMetadata(node, node.metadata, node.variables.variables[0].element); |
| 384 return null; | 384 return null; |
| 385 } | 385 } |
| 386 | 386 |
| 387 @override | 387 @override |
| 388 Object visitTypeParameter(TypeParameter node) { | 388 Object visitTypeParameter(TypeParameter node) { |
| 389 if (node.parent.parent is FunctionTypedFormalParameter) { |
| 390 // Work around dartbug.com/28515. |
| 391 // TODO(paulberry): remove this once dartbug.com/28515 is fixed. |
| 392 Element element = new TypeParameterElementImpl.forNode(node.name); |
| 393 node.name?.staticElement = element; |
| 394 return null; |
| 395 } |
| 389 Element element = _match(node.name, _walker.getTypeParameter()); | 396 Element element = _match(node.name, _walker.getTypeParameter()); |
| 390 super.visitTypeParameter(node); | 397 super.visitTypeParameter(node); |
| 391 _resolveMetadata(node, node.metadata, element); | 398 _resolveMetadata(node, node.metadata, element); |
| 392 return null; | 399 return null; |
| 393 } | 400 } |
| 394 | 401 |
| 395 @override | 402 @override |
| 396 Object visitVariableDeclaration(VariableDeclaration node) { | 403 Object visitVariableDeclaration(VariableDeclaration node) { |
| 397 VariableElement element = _match(node.name, _walker.getVariable()); | 404 VariableElement element = _match(node.name, _walker.getVariable()); |
| 398 Expression initializer = node.initializer; | 405 Expression initializer = node.initializer; |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 class _ElementMismatchException extends AnalysisException { | 722 class _ElementMismatchException extends AnalysisException { |
| 716 /** | 723 /** |
| 717 * Creates an exception to refer to the given [compilationUnit], [element], | 724 * Creates an exception to refer to the given [compilationUnit], [element], |
| 718 * and [cause]. | 725 * and [cause]. |
| 719 */ | 726 */ |
| 720 _ElementMismatchException( | 727 _ElementMismatchException( |
| 721 CompilationUnitElement compilationUnit, Element element, | 728 CompilationUnitElement compilationUnit, Element element, |
| 722 [CaughtException cause = null]) | 729 [CaughtException cause = null]) |
| 723 : super('Element mismatch in $compilationUnit at $element', cause); | 730 : super('Element mismatch in $compilationUnit at $element', cause); |
| 724 } | 731 } |
| OLD | NEW |