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

Side by Side Diff: pkg/analysis_server/test/services/index/dart_index_contributor_test.dart

Issue 1385403007: Fix for renaming (an invalid) ClassElement invocation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.services.src.index.dart_index_contributor; 5 library test.services.src.index.dart_index_contributor;
6 6
7 import 'package:analysis_server/plugin/index/index_core.dart'; 7 import 'package:analysis_server/plugin/index/index_core.dart';
8 import 'package:analysis_server/src/services/index/index.dart'; 8 import 'package:analysis_server/src/services/index/index.dart';
9 import 'package:analysis_server/src/services/index/index_contributor.dart'; 9 import 'package:analysis_server/src/services/index/index_contributor.dart';
10 import 'package:analysis_server/src/services/index/index_store.dart'; 10 import 'package:analysis_server/src/services/index/index_store.dart';
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY, 795 _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
796 _expectedLocation(vElement, 'A v;')); 796 _expectedLocation(vElement, 'A v;'));
797 _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY, 797 _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
798 _expectedLocation(mainElement, 'A(); // 2')); 798 _expectedLocation(mainElement, 'A(); // 2'));
799 _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY, 799 _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
800 _expectedLocation(mainElement, 'A.field = 1;')); 800 _expectedLocation(mainElement, 'A.field = 1;'));
801 _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY, 801 _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
802 _expectedLocation(mainElement, 'A.field); // 3')); 802 _expectedLocation(mainElement, 'A.field); // 3'));
803 } 803 }
804 804
805 void test_isReferencedBy_ClassElement_invocation() {
806 verifyNoTestUnitErrors = false;
807 _indexTestUnit('''
808 class A {}
809 main() {
810 A(); // invalid code, but still a reference
811 }''');
812 // prepare elements
813 Element mainElement = findElement('main');
814 Element classElement = findElement('A');
815 IndexableElement indexable = new IndexableElement(classElement);
816 // verify
817 _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
818 _expectedLocation(mainElement, 'A();'));
819 }
820
805 void test_isReferencedBy_ClassTypeAlias() { 821 void test_isReferencedBy_ClassTypeAlias() {
806 _indexTestUnit(''' 822 _indexTestUnit('''
807 class A {} 823 class A {}
808 class B = Object with A; 824 class B = Object with A;
809 main(B p) { 825 main(B p) {
810 B v; 826 B v;
811 } 827 }
812 '''); 828 ''');
813 // prepare elements 829 // prepare elements
814 ClassElement bElement = findElement("B"); 830 ClassElement bElement = findElement("B");
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 RecordedRelation(this.indexable, this.relationship, this.location); 1739 RecordedRelation(this.indexable, this.relationship, this.location);
1724 1740
1725 @override 1741 @override
1726 String toString() { 1742 String toString() {
1727 return 'RecordedRelation(indexable=$indexable; relationship=$relationship; ' 1743 return 'RecordedRelation(indexable=$indexable; relationship=$relationship; '
1728 'location=$location; flags=' 1744 'location=$location; flags='
1729 '${location.isQualified ? "Q" : ""}' 1745 '${location.isQualified ? "Q" : ""}'
1730 '${location.isResolved ? "R" : ""})'; 1746 '${location.isResolved ? "R" : ""})';
1731 } 1747 }
1732 } 1748 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698