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

Unified Diff: pkg/analyzer/test/src/summary/index_unit_test.dart

Issue 2203173002: Use unitMember/classMember/parameter names instead of offsets in index. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 | « pkg/analyzer/lib/src/summary/index_unit.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/summary/index_unit_test.dart
diff --git a/pkg/analyzer/test/src/summary/index_unit_test.dart b/pkg/analyzer/test/src/summary/index_unit_test.dart
index 1bf2cf5a611efe6bf8e2fed63eafbcd553b92282..f6851c8dff52fb85d60328ee084c779b611a8613 100644
--- a/pkg/analyzer/test/src/summary/index_unit_test.dart
+++ b/pkg/analyzer/test/src/summary/index_unit_test.dart
@@ -1134,12 +1134,34 @@ main() {
*/
int _findElementId(Element element) {
int unitId = _getUnitId(element);
- ElementInfo info = PackageIndexAssembler.newElementInfo(unitId, element);
+ // Prepare the element that was put into the index.
+ IndexElementInfo info = new IndexElementInfo(element);
+ element = info.element;
+ // Prepare element's name components.
+ int unitMemberId = _getStringId(PackageIndexAssembler.NULL_STRING);
+ int classMemberId = _getStringId(PackageIndexAssembler.NULL_STRING);
+ int parameterId = _getStringId(PackageIndexAssembler.NULL_STRING);
+ for (Element e = element; e != null; e = e.enclosingElement) {
+ if (e.enclosingElement is CompilationUnitElement) {
+ unitMemberId = _getStringId(e.name);
+ }
+ }
+ for (Element e = element; e != null; e = e.enclosingElement) {
+ if (e.enclosingElement is ClassElement) {
+ classMemberId = _getStringId(e.name);
+ }
+ }
+ if (element is ParameterElement) {
+ parameterId = _getStringId(element.name);
+ }
+ // Find the element's id.
for (int elementId = 0;
elementId < packageIndex.elementUnits.length;
elementId++) {
if (packageIndex.elementUnits[elementId] == unitId &&
- packageIndex.elementOffsets[elementId] == info.offset &&
+ packageIndex.elementNameUnitMemberIds[elementId] == unitMemberId &&
+ packageIndex.elementNameClassMemberIds[elementId] == classMemberId &&
+ packageIndex.elementNameParameterIds[elementId] == parameterId &&
packageIndex.elementKinds[elementId] == info.kind) {
return elementId;
}
« no previous file with comments | « pkg/analyzer/lib/src/summary/index_unit.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698