Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Side by Side Diff: pkg/analyzer/lib/dart/analysis/results.dart

Issue 2908543002: Add result interfaces used by AnalysisSession (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/analysis/driver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 'package:analyzer/dart/ast/ast.dart';
6 import 'package:analyzer/dart/element/element.dart';
7 import 'package:analyzer/error/error.dart';
8 import 'package:analyzer/src/generated/source.dart';
9
10 /**
11 * The result of performing some kind of analysis on a single file. Every result
12 * that implements this interface will also implement a sub-interface.
13 *
14 * Clients may not extend, implement or mix-in this class.
15 */
16 abstract class AnalysisResult {
17 /**
18 * The absolute and normalized path of the file that was analyzed.
19 */
20 String get filePath;
scheglov 2017/05/25 18:28:39 Could we drop "file" and use just "path"?
Brian Wilkerson 2017/05/25 19:43:57 Done
21
22 /**
23 * The state of the results.
24 */
25 ResultState get state;
26
27 /**
28 * The absolute URI of the file that was analyzed.
29 */
30 Uri get uri;
31 }
32
33 /**
34 * An analysis result that includes the errors computed during analysis.
35 *
36 * Clients may not extend, implement or mix-in this class.
37 */
38 abstract class AnalysisResultWithErrors implements AnalysisResult {
39 /**
40 * The analysis errors that were computed during analysis.
41 */
42 List<AnalysisError> get errors;
43
44 /**
45 * Information about lines in the content.
46 */
47 LineInfo get lineInfo;
48 }
49
50 /**
51 * The result of computing all of the errors contained in a single file, both
52 * syntactic and semantic.
53 *
54 * Clients may not extend, implement or mix-in this class.
55 */
56 abstract class ErrorsResult implements AnalysisResultWithErrors {}
57
58 /**
59 * The result of parsing of a single file. The errors returned include only
60 * those discovered during scanning and parsing.
61 *
62 * Clients may not extend, implement or mix-in this class.
63 */
64 abstract class ParseResult implements AnalysisResultWithErrors {
65 /**
66 * The content of the file that was scanned and parsed.
67 */
68 String get content;
69
70 /**
71 * The parsed, unresolved compilation unit for the [content].
72 */
73 CompilationUnit get unit;
74 }
75
76 /**
77 * The result of building a resolved AST for a single file. The errors returned
78 * include both syntactic and semantic errors.
79 *
80 * Clients may not extend, implement or mix-in this class.
81 */
82 abstract class ResolveResult implements AnalysisResultWithErrors {
83 /**
84 * The content of the file that was scanned, parsed and resolved.
85 */
86 String get content;
87
88 /**
89 * The fully resolved compilation unit for the [content].
90 */
91 CompilationUnit get unit;
92 }
93
94 /**
95 * An indication of whether an analysis result is valid, and if not why.
96 */
97 enum ResultState {
98 /**
99 * An indication that analysis could not be performed because the path
100 * represents a file of a type that cannot be analyzed.
101 */
102 INVALID_FILE_TYPE,
103
104 /**
105 * An indication that analysis could not be performed because the path does
106 * not represent a file. It might represent something else, such as a
107 * directory, or it might not represent anything.
108 */
109 NOT_A_FILE,
110
111 /**
112 * An indication that analysis completed normally and the results are valid.
113 */
114 VALID
115 }
116
117 /**
118 * The result of building the element model for a single file.
119 *
120 * Clients may not extend, implement or mix-in this class.
121 */
122 abstract class UnitElementResult implements AnalysisResult {
123 /**
124 * The element of the file.
125 */
126 CompilationUnitElement get element;
127
128 /**
129 * The signature of the library containing the [element]. This is the same
130 * signature returned by the method [AnalysisSession.getUnitElementSignature]
131 * when given the path to the compilation unit represented by the [element].
132 *
133 * The signature is based on the APIs of the files of the library (including
134 * the file itself), and the transitive closure of files imported and exported
135 * by the library. If the signature of a file has not changed, then there have
136 * been no changes that would cause any files that depend on it to need to be
137 * re-analyzed.
138 */
139 String get signature;
140 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/analysis/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698