| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * Provider for resolved and unresolved [CompilationUnit]s that contain, or | 11 * Provider for resolved and unresolved [CompilationUnit]s that contain, or |
| 12 * [AstNode]s that declare [Element]s. | 12 * [AstNode]s that declare [Element]s. |
| 13 */ | 13 */ |
| 14 abstract class AstProvider { | 14 abstract class AstProvider { |
| 15 AstNode findNodeForElement(CompilationUnit unit, Element element); | |
| 16 | |
| 17 /** | 15 /** |
| 18 * Completes with the parsed [AstNode] that declares the [element]. | 16 * Completes with the [SimpleIdentifier] that declares the [element]. The |
| 17 * enclosing unit is only parsed, but not resolved. Completes with `null` if |
| 18 * the [element] is synthetic, or the file where it is declared cannot be |
| 19 * parsed, etc. |
| 19 */ | 20 */ |
| 20 Future<T> getParsedNodeForElement<T extends AstNode>(Element element); | 21 Future<SimpleIdentifier> getParsedNameForElement(Element element); |
| 21 | 22 |
| 22 /** | 23 /** |
| 23 * Completes with the parsed [CompilationUnit] that contains the [element]. | 24 * Completes with the parsed [CompilationUnit] that contains the [element]. |
| 24 */ | 25 */ |
| 25 Future<CompilationUnit> getParsedUnitForElement(Element element); | 26 Future<CompilationUnit> getParsedUnitForElement(Element element); |
| 26 | 27 |
| 27 /** | 28 /** |
| 28 * Completes with the resolved [AstNode] that declares the [element]. | 29 * Completes with the [SimpleIdentifier] that declares the [element]. The |
| 30 * enclosing unit is fully resolved. Completes with `null` if the [element] |
| 31 * is synthetic, or the file where it is declared cannot be parsed and |
| 32 * resolved, etc. |
| 29 */ | 33 */ |
| 30 Future<T> getResolvedNodeForElement<T extends AstNode>(Element element); | 34 Future<SimpleIdentifier> getResolvedNameForElement(Element element); |
| 31 | 35 |
| 32 /** | 36 /** |
| 33 * Completes with the resolved [CompilationUnit] that contains the [element]. | 37 * Completes with the resolved [CompilationUnit] that contains the [element]. |
| 34 */ | 38 */ |
| 35 Future<CompilationUnit> getResolvedUnitForElement(Element element); | 39 Future<CompilationUnit> getResolvedUnitForElement(Element element); |
| 36 } | 40 } |
| OLD | NEW |