@@ -1452,7 +1452,7 @@ class AnalysisDriver {
14521452 if (withFineDependencies && requirements != null ) {
14531453 requirements.removeReqForLibs ({library.file.uri});
14541454
1455- performance.run ('writeResolvedLibrary' , (_ ) {
1455+ performance.run ('writeResolvedLibrary' , (performance ) {
14561456 var mapSink = BufferedSink ();
14571457 mapSink.writeMap (
14581458 fileResultBytesMap,
@@ -1470,6 +1470,7 @@ class AnalysisDriver {
14701470 requirements.write (sink);
14711471 sink.writeUint8List (mapBytes);
14721472 var allBytes = sink.takeBytes ();
1473+ performance.getDataInt ('bytes' ).add (allBytes.length);
14731474
14741475 var key = library.resolvedKey;
14751476 _byteStore.putGet (key, allBytes);
@@ -2088,50 +2089,50 @@ class AnalysisDriver {
20882089 }
20892090 return ;
20902091 }
2091- }
2092+ } else {
2093+ // Check if we have cached errors for all library files.
2094+ List <(FileState , String , Uint8List )>? forAllFiles = [];
2095+ for (var file in library.files) {
2096+ // If the file is priority, we need the resolved unit.
2097+ // So, the cached errors is not enough.
2098+ if (priorityFiles.contains (file.path)) {
2099+ forAllFiles = null ;
2100+ break ;
2101+ }
20922102
2093- // Check if we have cached errors for all library files.
2094- List <(FileState , String , Uint8List )>? forAllFiles = [];
2095- for (var file in library.files) {
2096- // If the file is priority, we need the resolved unit.
2097- // So, the cached errors is not enough.
2098- if (priorityFiles.contains (file.path)) {
2099- forAllFiles = null ;
2100- break ;
2101- }
2103+ var signature = _getResolvedUnitSignature (library, file);
2104+ var key = _getResolvedUnitKey (signature);
21022105
2103- var signature = _getResolvedUnitSignature (library, file);
2104- var key = _getResolvedUnitKey (signature);
2106+ var bytes = _byteStore.get (key);
2107+ if (bytes == null ) {
2108+ forAllFiles = null ;
2109+ break ;
2110+ }
21052111
2106- var bytes = _byteStore.get (key);
2107- if (bytes == null ) {
2108- forAllFiles = null ;
2109- break ;
2112+ // Will not be `null` here.
2113+ forAllFiles? .add ((file, signature, bytes));
21102114 }
21112115
2112- // Will not be `null` here.
2113- forAllFiles? .add ((file, signature, bytes));
2114- }
2116+ // If we have results for all library files, produce them.
2117+ if (forAllFiles != null ) {
2118+ for (var (file, signature, bytes) in forAllFiles) {
2119+ // We have the result for this file.
2120+ _fileTracker.fileWasAnalyzed (file.path);
21152121
2116- // If we have results for all library files, produce them.
2117- if (forAllFiles != null ) {
2118- for (var (file, signature, bytes) in forAllFiles) {
2119- // We have the result for this file.
2120- _fileTracker.fileWasAnalyzed (file.path);
2122+ // Don't produce the result if the signature is the same.
2123+ if (_lastProducedSignatures[file.path] == signature) {
2124+ continue ;
2125+ }
21212126
2122- // Don't produce the result if the signature is the same.
2123- if (_lastProducedSignatures[file.path] == signature) {
2124- continue ;
2127+ // Produce the result from bytes.
2128+ var result = _createErrorsResultFromBytes (file, library, bytes);
2129+ _lastProducedSignatures[file.path] = signature;
2130+ _errorsRequestedFiles.completeAll (file.path, result);
2131+ _scheduler.eventsController.add (result);
21252132 }
2126-
2127- // Produce the result from bytes.
2128- var result = _createErrorsResultFromBytes (file, library, bytes);
2129- _lastProducedSignatures[file.path] = signature;
2130- _errorsRequestedFiles.completeAll (file.path, result);
2131- _scheduler.eventsController.add (result);
2133+ // We produced all results for the library.
2134+ return ;
21322135 }
2133- // We produced all results for the library.
2134- return ;
21352136 }
21362137
21372138 performance.run ('analyzeFile' , (performance) {
0 commit comments