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

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

Issue 1750163003: Separate 'isQualified' flags as List<bool>. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
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 6b68f8470b232aa5e89557e44b7521bc279e4ecb..2d4cbd787edfbcda0e4c749197d71954fb4cd2ca 100644
--- a/pkg/analyzer/test/src/summary/index_unit_test.dart
+++ b/pkg/analyzer/test/src/summary/index_unit_test.dart
@@ -24,15 +24,14 @@ class ExpectedLocation {
final int offset;
final int length;
final bool isQualified;
- final bool isResolved;
- ExpectedLocation(this.unitElement, this.offset, this.length, this.isQualified,
- this.isResolved);
+ ExpectedLocation(
+ this.unitElement, this.offset, this.length, this.isQualified);
@override
String toString() {
return '(unit=$unitElement; offset=$offset; length=$length;'
- ' isQualified=$isQualified isResolved=$isResolved)';
+ ' isQualified=$isQualified)';
}
}
@@ -198,7 +197,7 @@ class A {
}''');
FieldElement field = findElement('field');
assertThat(field.getter)
- ..isInvokedQualifiedAt('field(); // q')
+ ..isInvokedAt('field(); // q', isQualified: true)
..isInvokedAt('field(); // nq');
}
@@ -218,7 +217,7 @@ main() {
}''');
FunctionElement element = importedUnit().functions[0];
assertThat(element)
- ..isInvokedQualifiedAt('foo(); // q')
+ ..isInvokedAt('foo(); // q', isQualified: true)
..isInvokedAt('foo(); // nq');
}
@@ -233,7 +232,7 @@ class A {
}''');
Element element = findElement('foo');
assertThat(element)
- ..isInvokedQualifiedAt('foo(); // q')
+ ..isInvokedAt('foo(); // q', isQualified: true)
..isInvokedAt('foo(); // nq');
}
@@ -248,7 +247,7 @@ main() {
}
''');
Element element = findElement('foo');
- assertThat(element).isInvokedQualifiedAt('foo();');
+ assertThat(element).isInvokedAt('foo();', isQualified: true);
}
void test_isInvokedBy_operator_binary() {
@@ -520,8 +519,8 @@ main(A a) {
assertThat(setter)..isReferencedAt('field = 1; // nq');
assertThat(getter)..isReferencedAt('field); // nq');
// main()
- assertThat(setter)..isReferencedQualifiedAt('field = 2; // q');
- assertThat(getter)..isReferencedQualifiedAt('field); // q');
+ assertThat(setter)..isReferencedAt('field = 2; // q', isQualified: true);
+ assertThat(getter)..isReferencedAt('field); // q', isQualified: true);
assertThat(field)..isReferencedAt('field: 3');
}
@@ -577,7 +576,7 @@ class A {
}''');
MethodElement element = findElement('method');
assertThat(element)
- ..isReferencedQualifiedAt('method); // q')
+ ..isReferencedAt('method); // q', isQualified: true)
..isReferencedAt('method); // nq');
}
@@ -611,10 +610,10 @@ main() {
TopLevelVariableElement variable = importedUnit().topLevelVariables[0];
assertThat(variable)..isReferencedAt('V; // imp');
assertThat(variable.getter)
- ..isReferencedQualifiedAt('V); // q')
+ ..isReferencedAt('V); // q', isQualified: true)
..isReferencedAt('V); // nq');
assertThat(variable.setter)
- ..isReferencedQualifiedAt('V = 5; // q')
+ ..isReferencedAt('V = 5; // q', isQualified: true)
..isReferencedAt('V = 5; // nq');
}
@@ -704,8 +703,9 @@ main(C c) {
}
}
if (matchIndex != null &&
- unitIndex.usedElementKinds[matchIndex] == expectedRelationKind) {
- // TODO(scheglov) verify 'qualified' and 'resolved'
+ unitIndex.usedElementKinds[matchIndex] == expectedRelationKind &&
+ unitIndex.usedElementIsQualifiedFlags[matchIndex] ==
+ expectedLocation.isQualified) {
return;
}
_failWithIndexDump(
@@ -722,7 +722,6 @@ main(C c) {
if (isNot) {
_failWithIndexDump('Unexpected $name $kind at $expectedLocation');
}
- // TODO(scheglov) verify 'qualified' and 'resolved'
return;
}
}
@@ -733,13 +732,12 @@ main(C c) {
}
ExpectedLocation _expectedLocation(String search,
- {int length, bool isQualified: false, bool isResolved: true}) {
+ {int length, bool isQualified: false}) {
int offset = findOffset(search);
if (length == null) {
length = getLeadingIdentifierLength(search);
}
- return new ExpectedLocation(
- testUnitElement, offset, length, isQualified, isResolved);
+ return new ExpectedLocation(testUnitElement, offset, length, isQualified);
}
void _failWithIndexDump(String msg) {
@@ -831,14 +829,12 @@ class _ElementIndexAssert {
test._expectedLocation(search, length: length));
}
- void isInvokedAt(String search, {int length}) {
- test._assertHasRelation(element, IndexRelationKind.IS_INVOKED_BY,
- test._expectedLocation(search, length: length));
- }
-
- void isInvokedQualifiedAt(String search, {int length}) {
- test._assertHasRelation(element, IndexRelationKind.IS_INVOKED_QUALIFIED_BY,
- test._expectedLocation(search, length: length));
+ void isInvokedAt(String search, {int length, bool isQualified: false}) {
+ test._assertHasRelation(
+ element,
+ IndexRelationKind.IS_INVOKED_BY,
+ test._expectedLocation(search,
+ length: length, isQualified: isQualified));
}
void isMixedInAt(String search, {int length}) {
@@ -846,16 +842,12 @@ class _ElementIndexAssert {
test._expectedLocation(search, length: length));
}
- void isReferencedAt(String search, {int length}) {
- test._assertHasRelation(element, IndexRelationKind.IS_REFERENCED_BY,
- test._expectedLocation(search, length: length));
- }
-
- void isReferencedQualifiedAt(String search, {int length}) {
+ void isReferencedAt(String search, {int length, bool isQualified: false}) {
test._assertHasRelation(
element,
- IndexRelationKind.IS_REFERENCED_QUALIFIED_BY,
- test._expectedLocation(search, length: length));
+ IndexRelationKind.IS_REFERENCED_BY,
+ test._expectedLocation(search,
+ length: length, isQualified: isQualified));
}
}

Powered by Google App Engine
This is Rietveld 408576698