| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.dart.ast.utilities; | 5 library analyzer.src.dart.ast.utilities; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2494 Element visitClassDeclaration(ClassDeclaration node) => node.element; | 2494 Element visitClassDeclaration(ClassDeclaration node) => node.element; |
| 2495 | 2495 |
| 2496 @override | 2496 @override |
| 2497 Element visitCompilationUnit(CompilationUnit node) => node.element; | 2497 Element visitCompilationUnit(CompilationUnit node) => node.element; |
| 2498 | 2498 |
| 2499 @override | 2499 @override |
| 2500 Element visitConstructorDeclaration(ConstructorDeclaration node) => | 2500 Element visitConstructorDeclaration(ConstructorDeclaration node) => |
| 2501 node.element; | 2501 node.element; |
| 2502 | 2502 |
| 2503 @override | 2503 @override |
| 2504 Element visitExportDirective(ExportDirective node) => node.element; |
| 2505 |
| 2506 @override |
| 2504 Element visitFunctionDeclaration(FunctionDeclaration node) => node.element; | 2507 Element visitFunctionDeclaration(FunctionDeclaration node) => node.element; |
| 2505 | 2508 |
| 2506 @override | 2509 @override |
| 2507 Element visitIdentifier(Identifier node) { | 2510 Element visitIdentifier(Identifier node) { |
| 2508 AstNode parent = node.parent; | 2511 AstNode parent = node.parent; |
| 2509 if (parent is Annotation) { | 2512 if (parent is Annotation) { |
| 2510 // Type name in Annotation | 2513 // Type name in Annotation |
| 2511 if (identical(parent.name, node) && parent.constructorName == null) { | 2514 if (identical(parent.name, node) && parent.constructorName == null) { |
| 2512 return parent.element; | 2515 return parent.element; |
| 2513 } | 2516 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2525 return element.unnamedConstructor; | 2528 return element.unnamedConstructor; |
| 2526 } | 2529 } |
| 2527 } | 2530 } |
| 2528 } else if (parent is LibraryIdentifier) { | 2531 } else if (parent is LibraryIdentifier) { |
| 2529 AstNode grandParent = parent.parent; | 2532 AstNode grandParent = parent.parent; |
| 2530 if (grandParent is PartOfDirective) { | 2533 if (grandParent is PartOfDirective) { |
| 2531 Element element = grandParent.element; | 2534 Element element = grandParent.element; |
| 2532 if (element is LibraryElement) { | 2535 if (element is LibraryElement) { |
| 2533 return element.definingCompilationUnit; | 2536 return element.definingCompilationUnit; |
| 2534 } | 2537 } |
| 2538 } else if (grandParent is LibraryDirective) { |
| 2539 return grandParent.element; |
| 2535 } | 2540 } |
| 2536 } | 2541 } |
| 2537 return node.bestElement; | 2542 return node.bestElement; |
| 2538 } | 2543 } |
| 2539 | 2544 |
| 2540 @override | 2545 @override |
| 2541 Element visitImportDirective(ImportDirective node) => node.element; | 2546 Element visitImportDirective(ImportDirective node) => node.element; |
| 2542 | 2547 |
| 2543 @override | 2548 @override |
| 2544 Element visitIndexExpression(IndexExpression node) => node.bestElement; | 2549 Element visitIndexExpression(IndexExpression node) => node.bestElement; |
| (...skipping 5241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7786 * Safely visit the given [token], printing the [suffix] after the token if it | 7791 * Safely visit the given [token], printing the [suffix] after the token if it |
| 7787 * is non-`null`. | 7792 * is non-`null`. |
| 7788 */ | 7793 */ |
| 7789 void _visitTokenWithSuffix(Token token, String suffix) { | 7794 void _visitTokenWithSuffix(Token token, String suffix) { |
| 7790 if (token != null) { | 7795 if (token != null) { |
| 7791 _writer.print(token.lexeme); | 7796 _writer.print(token.lexeme); |
| 7792 _writer.print(suffix); | 7797 _writer.print(suffix); |
| 7793 } | 7798 } |
| 7794 } | 7799 } |
| 7795 } | 7800 } |
| OLD | NEW |