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

Unified Diff: pkg/analysis_server/lib/src/services/index/index.dart

Issue 1946353004: Issue 26355. Don't overwrite full index with declarations-only one. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/index/index_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/index/index.dart
diff --git a/pkg/analysis_server/lib/src/services/index/index.dart b/pkg/analysis_server/lib/src/services/index/index.dart
index bf5e47da65e6c3a2a4af6120eed2ea7e83a322fa..7270ac241aec63b6d5f45d6e6bf2c269bff5fbdc 100644
--- a/pkg/analysis_server/lib/src/services/index/index.dart
+++ b/pkg/analysis_server/lib/src/services/index/index.dart
@@ -270,18 +270,22 @@ class _ContextIndex {
* Index declarations in the given partially resolved [unit].
*/
void indexDeclarations(CompilationUnit unit) {
- PackageIndexAssembler assembler = new PackageIndexAssembler();
- assembler.indexDeclarations(unit);
- _putUnitIndexBuilder(unit, assembler);
+ String key = _getUnitKeyForElement(unit.element);
+ if (!indexMap.containsKey(key)) {
+ PackageIndexAssembler assembler = new PackageIndexAssembler();
+ assembler.indexDeclarations(unit);
+ _putUnitIndexBuilder(key, assembler);
+ }
}
/**
* Index the given fully resolved [unit].
*/
void indexUnit(CompilationUnit unit) {
+ String key = _getUnitKeyForElement(unit.element);
PackageIndexAssembler assembler = new PackageIndexAssembler();
assembler.indexUnit(unit);
- _putUnitIndexBuilder(unit, assembler);
+ _putUnitIndexBuilder(key, assembler);
}
/**
@@ -315,13 +319,11 @@ class _ContextIndex {
return locations;
}
- void _putUnitIndexBuilder(
- CompilationUnit unit, PackageIndexAssembler assembler) {
+ void _putUnitIndexBuilder(String key, PackageIndexAssembler assembler) {
PackageIndexBuilder indexBuilder = assembler.assemble();
// Put the index into the map.
List<int> indexBytes = indexBuilder.toBuffer();
PackageIndex index = new PackageIndex.fromBuffer(indexBytes);
- String key = _getUnitKeyForElement(unit.element);
indexMap[key] = index;
}
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/index/index_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698