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

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

Issue 1779233002: Fix for indexing synthetic elements. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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/lib/src/services/search/search_engine_internal2.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/index2/index2.dart
diff --git a/pkg/analysis_server/lib/src/services/index2/index2.dart b/pkg/analysis_server/lib/src/services/index2/index2.dart
index 0ad8ca331be6fcd045440b80d94a4f9d867750b9..aeff8c94867575689ad54122220b2b1bfdddd739 100644
--- a/pkg/analysis_server/lib/src/services/index2/index2.dart
+++ b/pkg/analysis_server/lib/src/services/index2/index2.dart
@@ -305,25 +305,20 @@ class _PackageIndexRequester {
if (unitId == -1) {
return -1;
}
- // Prepare the offset of the element.
- int offset = element.nameOffset;
- if (element is LibraryElement || element is CompilationUnitElement) {
- offset = 0;
- }
+ // Prepare information about the element.
+ ElementInfo info = PackageIndexAssembler.newElementInfo(unitId, element);
// Find the first occurrence of an element with the same offset.
- int elementId = _findFirstOccurrence(index.elementOffsets, offset);
+ int elementId = _findFirstOccurrence(index.elementOffsets, info.offset);
if (elementId == -1) {
return -1;
}
// Try to find the element id using offset, unit and kind.
- IndexSyntheticElementKind kind =
- PackageIndexAssembler.getIndexElementKind(element);
for (;
elementId < index.elementOffsets.length &&
- index.elementOffsets[elementId] == offset;
+ index.elementOffsets[elementId] == info.offset;
elementId++) {
if (index.elementUnits[elementId] == unitId &&
- index.elementKinds[elementId] == kind) {
+ index.elementKinds[elementId] == info.kind) {
return elementId;
}
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/search/search_engine_internal2.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698