Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 import 'dart:async'; | |
| 6 | |
| 7 import 'package:analyzer/dart/analysis/results.dart'; | |
| 8 import 'package:analyzer/dart/element/element.dart'; | |
| 9 import 'package:analyzer/exception/exception.dart'; | |
| 10 import 'package:analyzer/src/dart/analysis/top_level_declaration.dart'; | |
| 11 import 'package:analyzer/src/generated/resolver.dart'; | |
| 12 import 'package:analyzer/src/generated/source.dart'; | |
| 13 | |
| 14 /** | |
| 15 * A consistent view of the results of analyzing one or more files. | |
| 16 * | |
| 17 * The methods in this class that return analysis results will throw an | |
| 18 * InconsistentAnalysisException if the result to be returned might be | |
|
scheglov
2017/06/26 15:30:03
Maybe [InconsistentAnalysisException] to make it i
Brian Wilkerson
2017/06/26 16:06:19
Done
| |
| 19 * inconsistent with any previously returned results. | |
| 20 * | |
| 21 * Clients may not extend, implement or mix-in this class. | |
| 22 */ | |
| 23 abstract class AnalysisSession { | |
| 24 /** | |
| 25 * Return a type provider that is consistent with the results returned by this | |
| 26 * session. | |
| 27 */ | |
| 28 Future<TypeProvider> get typeProvider; | |
| 29 | |
| 30 /** | |
| 31 * Return the type system being used by this session. | |
| 32 */ | |
| 33 Future<TypeSystem> get typeSystem; | |
| 34 | |
| 35 /** | |
| 36 * Return a future that will complete with information about the errors | |
| 37 * contained in the file with the given absolute, normalized [path]. | |
| 38 * | |
| 39 * If the file cannot be analyzed by this session, then the result will have | |
| 40 * a result state indicating the nature of the problem. | |
| 41 */ | |
| 42 Future<ErrorsResult> getErrors(String path); | |
| 43 | |
| 44 /** | |
| 45 * Return a future that will complete with the library element representing | |
| 46 * the library with the given [uri]. | |
| 47 */ | |
| 48 Future<LibraryElement> getLibraryByUri(String uri); | |
| 49 | |
| 50 /** | |
| 51 * Return a future that will complete with information about the results of | |
| 52 * parsing the file with the given absolute, normalized [path]. | |
| 53 */ | |
| 54 Future<ParseResult> getParsedAst(String path); | |
| 55 | |
| 56 /** | |
| 57 * Return a future that will complete with information about the results of | |
| 58 * resolving the file with the given absolute, normalized [path]. | |
| 59 */ | |
| 60 Future<ResolveResult> getResolvedAst(String path); | |
| 61 | |
| 62 /** | |
| 63 * Return a future that will complete with the source kind of the file with | |
| 64 * the given absolute, normalized [path]. If the path does not represent a | |
| 65 * file or if the kind of the file cannot be determined, then the future will | |
| 66 * complete with [SourceKind.UNKNOWN]. | |
| 67 */ | |
| 68 Future<SourceKind> getSourceKind(String path); | |
| 69 | |
| 70 /** | |
| 71 * Return a future that will complete with a list of the top-level | |
| 72 * declarations with the given [name] in all known libraries. | |
| 73 */ | |
| 74 Future<List<TopLevelDeclarationInSource>> getTopLevelDeclarations( | |
| 75 String name); | |
| 76 | |
| 77 /** | |
| 78 * Return a future that will complete with information about the results of | |
| 79 * building the element model for the file with the given absolute, normalized | |
| 80 * [path]. | |
| 81 */ | |
| 82 Future<UnitElementResult> getUnitElement(String path); | |
| 83 | |
| 84 /** | |
| 85 * Return a future that will complete with the signature for the file with the | |
| 86 * given absolute, normalized [path], or `null` if the file cannot be analyzed . | |
| 87 * This is the same signature returned in the result from [getUnitElement]. | |
| 88 * | |
| 89 * The signature is based on the APIs of the files of the library (including | |
| 90 * the file itself), and the transitive closure of files imported and exported | |
| 91 * by the library. If the signature of a file has not changed, then there have | |
| 92 * been no changes that would cause any files that depend on it to need to be | |
| 93 * re-analyzed. | |
| 94 */ | |
| 95 Future<String> getUnitElementSignature(String path); | |
| 96 } | |
| 97 | |
| 98 /** | |
| 99 * The exception thrown by an [AnalysisSession] if a result is requested that | |
| 100 * might be inconsistent with any previously returned results. | |
| 101 */ | |
| 102 class InconsistentAnalysisException extends AnalysisException { | |
| 103 /** | |
| 104 * Initialize a newly created exception to have the given [message] and | |
| 105 * [cause]. | |
| 106 */ | |
| 107 InconsistentAnalysisException([String message, CaughtException cause]) | |
| 108 : super(message, cause); | |
| 109 } | |
| OLD | NEW |