Include all library files with Cider exception.
R=brianwilkerson@google.com, keertip@google.com
Change-Id: I894a7504cb19249c812212f3ef65ce5f10737e7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163820
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
index 7d07bcf..6ab29c1 100644
--- a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
+++ b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
@@ -22,6 +22,7 @@
import 'package:analyzer/src/dart/micro/cider_byte_store.dart';
import 'package:analyzer/src/dart/micro/library_analyzer.dart';
import 'package:analyzer/src/dart/micro/library_graph.dart';
+import 'package:analyzer/src/exception/exception.dart';
import 'package:analyzer/src/generated/engine.dart'
show AnalysisEngine, AnalysisOptionsImpl;
import 'package:analyzer/src/generated/source.dart';
@@ -307,15 +308,28 @@
(file) => file.getContentWithSameDigest(),
);
- results = performance.run('analyze', (performance) {
- return NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- return libraryAnalyzer.analyzeSync(
- completionPath: completionOffset != null ? path : null,
- completionOffset: completionOffset,
- performance: performance,
- );
+ try {
+ results = performance.run('analyze', (performance) {
+ return NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
+ return libraryAnalyzer.analyzeSync(
+ completionPath: completionOffset != null ? path : null,
+ completionOffset: completionOffset,
+ performance: performance,
+ );
+ });
});
- });
+ } catch (exception, stackTrace) {
+ var fileContentMap = <String, String>{};
+ for (var file in libraryFile.libraryFiles) {
+ var path = file.path;
+ fileContentMap[path] = _getFileContent(path);
+ }
+ throw CaughtExceptionWithFiles(
+ exception,
+ stackTrace,
+ fileContentMap,
+ );
+ }
});
UnitAnalysisResult fileResult = results[file];