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

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

Issue 1809823002: Don't index library identifiers. (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 | « 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 a8a3f4f042604c99bfb629718e1fa6c46d160c48..6cf35206dd32082de6484f2e21c09a78186a1a96 100644
--- a/pkg/analyzer/test/src/summary/index_unit_test.dart
+++ b/pkg/analyzer/test/src/summary/index_unit_test.dart
@@ -908,6 +908,22 @@ class A {
..isWrittenAt('field = 5', true);
}
+ void test_usedName_inLibraryIdentifier() {
+ verifyNoTestUnitErrors = false;
+ _indexTestUnit('''
+library aaa.bbb.ccc;
+class C {
+ var bbb;
+}
+main(p) {
+ p.bbb = 1;
+}
+''');
+ assertThatName('bbb')
+ ..isNotUsed('bbb.ccc', IndexRelationKind.IS_READ_BY)
+ ..isUsedQ('bbb = 1;', IndexRelationKind.IS_WRITTEN_BY);
+ }
+
void test_usedName_qualified_resolved() {
verifyNoTestUnitErrors = false;
_indexTestUnit('''
@@ -922,10 +938,10 @@ main(C c) {
}
''');
assertThatName('x')
- ..isNotUsed('x;', IndexRelationKind.IS_READ_BY)
- ..isNotUsed('x = 1;', IndexRelationKind.IS_WRITTEN_BY)
- ..isNotUsed('x += 2;', IndexRelationKind.IS_READ_WRITTEN_BY)
- ..isNotUsed('x();', IndexRelationKind.IS_INVOKED_BY);
+ ..isNotUsedQ('x;', IndexRelationKind.IS_READ_BY)
+ ..isNotUsedQ('x = 1;', IndexRelationKind.IS_WRITTEN_BY)
+ ..isNotUsedQ('x += 2;', IndexRelationKind.IS_READ_WRITTEN_BY)
+ ..isNotUsedQ('x();', IndexRelationKind.IS_INVOKED_BY);
}
void test_usedName_qualified_unresolved() {
@@ -959,10 +975,10 @@ class C {
}
''');
assertThatName('x')
- ..isNotUsed('x;', IndexRelationKind.IS_READ_BY)
- ..isNotUsed('x = 1;', IndexRelationKind.IS_WRITTEN_BY)
- ..isNotUsed('x += 2;', IndexRelationKind.IS_READ_WRITTEN_BY)
- ..isNotUsed('x();', IndexRelationKind.IS_INVOKED_BY);
+ ..isNotUsedQ('x;', IndexRelationKind.IS_READ_BY)
+ ..isNotUsedQ('x = 1;', IndexRelationKind.IS_WRITTEN_BY)
+ ..isNotUsedQ('x += 2;', IndexRelationKind.IS_READ_WRITTEN_BY)
+ ..isNotUsedQ('x();', IndexRelationKind.IS_INVOKED_BY);
}
void test_usedName_unqualified_unresolved() {
@@ -1201,6 +1217,11 @@ class _NameIndexAssert {
void isNotUsed(String search, IndexRelationKind kind) {
test._assertUsedName(
+ name, kind, test._expectedLocation(search, false), true);
+ }
+
+ void isNotUsedQ(String search, IndexRelationKind kind) {
+ test._assertUsedName(
name, kind, test._expectedLocation(search, true), true);
}
« 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