@@ -1833,28 +1833,51 @@ class AnalysisDriver {
18331833 }
18341834
18351835 void _getIndex (String path) {
1836- var file = _fsState.getFileForPath (path);
1836+ scheduler.accumulatedPerformance.run ('getIndex' , (performance) {
1837+ var file = _fsState.getFileForPath (path);
18371838
1838- // Prepare the library - the file itself, or the known library.
1839- var kind = file.kind;
1840- var library = kind.library ?? kind.asLibrary;
1839+ // Prepare the library - the file itself, or the known library.
1840+ var kind = file.kind;
1841+ var library = kind.library ?? kind.asLibrary;
18411842
1842- if (_completeRequestsIfMissingSdkLibrary (library)) {
1843- return ;
1844- }
1843+ if (_completeRequestsIfMissingSdkLibrary (library)) {
1844+ return ;
1845+ }
18451846
1846- // Prepare the signature and key.
1847- var signature = _getResolvedUnitSignature (library, file);
1848- var key = _getResolvedUnitKey (signature);
1847+ // Index is based on elements, so load them.
1848+ performance.run ('libraryContext' , (performance) {
1849+ libraryContext.load (targetLibrary: library, performance: performance);
1850+ });
18491851
1850- var bytes = _byteStore.get (key);
1851- if (bytes != null ) {
1852- var unit = AnalysisDriverResolvedUnit .fromBuffer (bytes);
1853- _indexRequestedFiles.completeAll (path, unit.index! );
1854- return ;
1855- }
1852+ if (withFineDependencies) {
1853+ var bundle = _getLibraryDiagnosticsBundle (
1854+ library: library,
1855+ performance: performance,
1856+ );
18561857
1857- _analyzeFile (path);
1858+ if (bundle != null ) {
1859+ var bytes = bundle.serializedFileResults[file.uri]! ;
1860+ var unit = AnalysisDriverResolvedUnit .fromBuffer (bytes);
1861+ _indexRequestedFiles.completeAll (path, unit.index! );
1862+ return ;
1863+ }
1864+ }
1865+
1866+ // Prepare the signature and key.
1867+ var signature = _getResolvedUnitSignature (library, file);
1868+ var key = _getResolvedUnitKey (signature);
1869+
1870+ var bytes = _byteStore.get (key);
1871+ if (bytes != null ) {
1872+ var unit = AnalysisDriverResolvedUnit .fromBuffer (bytes);
1873+ _indexRequestedFiles.completeAll (path, unit.index! );
1874+ return ;
1875+ }
1876+
1877+ performance.run ('analyzeFile' , (performance) {
1878+ _analyzeFileImpl (path: path, performance: performance);
1879+ });
1880+ });
18581881 }
18591882
18601883 /// Returns the [LibraryDiagnosticsBundle] for the given [library] .
0 commit comments