Skip to content

Commit 6d65549

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Include all files of the library into ExceptionResult.
[email protected] Change-Id: I53fc35470ab841e602917af78a37f9b1c0e419b4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153708 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent c71d40f commit 6d65549

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

pkg/analyzer/lib/src/dart/analysis/driver.dart

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,12 +1642,20 @@ class AnalysisDriver implements AnalysisDriverGeneric {
16421642
stackTrace = state.stackTrace;
16431643
contextKey = state.contextKey;
16441644
}
1645+
16451646
CaughtException caught = CaughtException(exception, stackTrace);
1646-
String fileContent = _fsState.getFileForPath(path).content;
1647+
1648+
var fileContentMap = <String, String>{};
1649+
var libraryFile = _fsState.getFileForPath(path);
1650+
for (var file in libraryFile.libraryFiles) {
1651+
fileContentMap[file.path] = file.content;
1652+
}
1653+
16471654
_exceptionController.add(
16481655
ExceptionResult(
16491656
filePath: path,
1650-
fileContent: fileContent,
1657+
fileContentMap: fileContentMap,
1658+
fileContent: libraryFile.content,
16511659
exception: caught,
16521660
contextKey: contextKey,
16531661
),
@@ -2140,15 +2148,19 @@ class ErrorEncoding {
21402148

21412149
/// Exception that happened during analysis.
21422150
class ExceptionResult {
2143-
/// The path of the file being analyzed when the [exception] happened.
2151+
/// The path of the library being analyzed when the [exception] happened.
21442152
///
21452153
/// Absolute and normalized.
21462154
final String filePath;
21472155

2156+
/// The content of the library and its parts.
2157+
final Map<String, String> fileContentMap;
2158+
21482159
/// The path of the file being analyzed when the [exception] happened.
2160+
@Deprecated('Use fileContentMap instead')
21492161
final String fileContent;
21502162

2151-
/// The exception during analysis of the file with the [path].
2163+
/// The exception during analysis of the file with the [filePath].
21522164
final CaughtException exception;
21532165

21542166
/// If the exception happened during a file analysis, and the context in which
@@ -2159,6 +2171,7 @@ class ExceptionResult {
21592171

21602172
ExceptionResult({
21612173
@required this.filePath,
2174+
@required this.fileContentMap,
21622175
@required this.fileContent,
21632176
@required this.exception,
21642177
@required this.contextKey,

0 commit comments

Comments
 (0)