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

Unified Diff: pkg/analysis_server/test/services/index/dart_index_contributor_test.dart

Issue 783223003: Issue 21801. Index redirecting constructor invocations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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/analysis_server/lib/src/services/index/index_contributor.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/index/dart_index_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/index/dart_index_contributor_test.dart b/pkg/analysis_server/test/services/index/dart_index_contributor_test.dart
index a146312cc0b89486b135caff75d02c94a624f6a8..89eda4b216e1bf8c99cae2bb4bb4d8faf850519b 100644
--- a/pkg/analysis_server/test/services/index/dart_index_contributor_test.dart
+++ b/pkg/analysis_server/test/services/index/dart_index_contributor_test.dart
@@ -294,7 +294,6 @@ class C = Object with A implements B; // 3
_expectedLocation(classElementC, 'B; // 3'));
}
-
void test_isInvokedBy_FieldElement() {
_indexTestUnit('''
class A {
@@ -788,6 +787,34 @@ main() {
_expectedLocation(mainElement, '.named(); // marker-main-2', length: 6));
}
+ void test_isReferencedBy_ConstructorElement_redirection() {
+ _indexTestUnit('''
+class A {
+ A() : this.bar();
+ A.foo() : this(); // marker
+ A.bar();
+}
+''');
+ // prepare elements
+ var isConstructor = (node) => node is ConstructorDeclaration;
+ ConstructorElement constructorA =
+ findNodeElementAtString("A()", isConstructor);
+ ConstructorElement constructorA_foo =
+ findNodeElementAtString("A.foo()", isConstructor);
+ ConstructorElement constructorA_bar =
+ findNodeElementAtString("A.bar()", isConstructor);
+ // A()
+ _assertRecordedRelation(
+ constructorA,
+ IndexConstants.IS_REFERENCED_BY,
+ _expectedLocation(constructorA_foo, '(); // marker', length: 0));
+ // A.foo()
+ _assertRecordedRelation(
+ constructorA_bar,
+ IndexConstants.IS_REFERENCED_BY,
+ _expectedLocation(constructorA, '.bar();', length: 4));
+ }
+
void test_isReferencedBy_ConstructorFieldInitializer() {
_indexTestUnit('''
class A {
« no previous file with comments | « pkg/analysis_server/lib/src/services/index/index_contributor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698