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

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

Issue 1816583002: Issue 26034#3. Fix for indexing references to synthetic fields. (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 6cf35206dd32082de6484f2e21c09a78186a1a96..f9639e260e387248e927c08e74de593414d6ccbf 100644
--- a/pkg/analyzer/test/src/summary/index_unit_test.dart
+++ b/pkg/analyzer/test/src/summary/index_unit_test.dart
@@ -763,6 +763,43 @@ main() {
assertThat(enumElement.getGetter('B'))..isReferencedAt('B);', true);
}
+ void test_isReferencedBy_FieldElement_synthetic_hasGetter() {
+ verifyNoTestUnitErrors = false;
+ _indexTestUnit('''
+class A {
+ A() : f = 42;
+ int get f => 0;
+}
+''');
+ ClassElement element2 = findElement('A');
+ assertThat(element2.getField('f')).isWrittenAt('f = 42', true);
+ }
+
+ void test_isReferencedBy_FieldElement_synthetic_hasGetterSetter() {
+ verifyNoTestUnitErrors = false;
+ _indexTestUnit('''
+class A {
+ A() : f = 42;
+ int get f => 0;
+ set f(_) {}
+}
+''');
+ ClassElement element2 = findElement('A');
+ assertThat(element2.getField('f')).isWrittenAt('f = 42', true);
+ }
+
+ void test_isReferencedBy_FieldElement_synthetic_hasSetter() {
+ verifyNoTestUnitErrors = false;
+ _indexTestUnit('''
+class A {
+ A() : f = 42;
+ set f(_) {}
+}
+''');
+ ClassElement element2 = findElement('A');
+ assertThat(element2.getField('f')).isWrittenAt('f = 42', true);
+ }
+
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