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

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

Issue 1786023005: Fix for indexing synthetic getter/setter references. (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 00fbea6c969acd9c5a1f455dac290efcb3dec1b7..90547ec654a056b7701bb658b0a10b4b77dc783d 100644
--- a/pkg/analyzer/test/src/summary/index_unit_test.dart
+++ b/pkg/analyzer/test/src/summary/index_unit_test.dart
@@ -701,6 +701,40 @@ main(A a) {
assertThat(field)..isReferencedAt('field: 4', true);
}
+ void test_isReferencedBy_FieldElement_multiple() {
+ _indexTestUnit('''
+class A {
+ var aaa;
+ var bbb;
+ A(this.aaa, this.bbb) {}
+ m() {
+ print(aaa);
+ aaa = 1;
+ print(bbb);
+ bbb = 2;
+ }
+}
+''');
+ // aaa
+ {
+ FieldElement field = findElement('aaa');
+ PropertyAccessorElement getter = field.getter;
+ PropertyAccessorElement setter = field.setter;
+ assertThat(field)..isWrittenAt('aaa, ', true);
+ assertThat(getter)..isReferencedAt('aaa);', false);
+ assertThat(setter)..isReferencedAt('aaa = 1;', false);
+ }
+ // bbb
+ {
+ FieldElement field = findElement('bbb');
+ PropertyAccessorElement getter = field.getter;
+ PropertyAccessorElement setter = field.setter;
+ assertThat(field)..isWrittenAt('bbb) {}', true);
+ assertThat(getter)..isReferencedAt('bbb);', false);
+ assertThat(setter)..isReferencedAt('bbb = 2;', false);
+ }
+ }
+
void test_isReferencedBy_FunctionElement() {
_indexTestUnit('''
foo() {}
« 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