| 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 83da4c2169327853d8f95806a198e797e81ecaeb..1aedae8c7219dca5efedc349f2770706ccfa871d 100644
|
| --- a/pkg/analyzer/test/src/summary/index_unit_test.dart
|
| +++ b/pkg/analyzer/test/src/summary/index_unit_test.dart
|
| @@ -392,6 +392,21 @@ main(A a) {
|
| assertThat(element).isInvokedAt('~a', true, length: 1);
|
| }
|
|
|
| + void test_isInvokedBy_PropertyAccessorElement_getter() {
|
| + _indexTestUnit('''
|
| +class A {
|
| + get ggg => null;
|
| + main() {
|
| + this.ggg(); // q
|
| + ggg(); // nq
|
| + }
|
| +}''');
|
| + PropertyAccessorElement element = findElement('ggg', ElementKind.GETTER);
|
| + assertThat(element)
|
| + ..isInvokedAt('ggg(); // q', true)
|
| + ..isInvokedAt('ggg(); // nq', false);
|
| + }
|
| +
|
| void test_isMixedInBy_ClassDeclaration() {
|
| _indexTestUnit('''
|
| class A {} // 1
|
| @@ -625,6 +640,19 @@ class A {
|
| assertThat(constA_bar).isReferencedAt('.bar(); // 1', true, length: 4);
|
| }
|
|
|
| + void test_isReferencedBy_ConstructorElement_synthetic() {
|
| + _indexTestUnit('''
|
| +class A {}
|
| +main() {
|
| + new A(); // 1
|
| +}
|
| +''');
|
| + ClassElement classA = findElement('A');
|
| + ConstructorElement constA = classA.constructors[0];
|
| + // A()
|
| + assertThat(constA)..isReferencedAt('(); // 1', true, length: 0);
|
| + }
|
| +
|
| void test_isReferencedBy_ConstructorFieldInitializer() {
|
| _indexTestUnit('''
|
| class A {
|
| @@ -884,18 +912,13 @@ main(C c) {
|
| */
|
| int _findElementId(Element element) {
|
| int unitId = _getUnitId(element);
|
| - int offset = element.nameOffset;
|
| - if (element is LibraryElement || element is CompilationUnitElement) {
|
| - offset = 0;
|
| - }
|
| - IndexSyntheticElementKind kind =
|
| - PackageIndexAssembler.getIndexElementKind(element);
|
| + ElementInfo info = PackageIndexAssembler.newElementInfo(unitId, element);
|
| for (int elementId = 0;
|
| elementId < packageIndex.elementUnits.length;
|
| elementId++) {
|
| if (packageIndex.elementUnits[elementId] == unitId &&
|
| - packageIndex.elementOffsets[elementId] == offset &&
|
| - packageIndex.elementKinds[elementId] == kind) {
|
| + packageIndex.elementOffsets[elementId] == info.offset &&
|
| + packageIndex.elementKinds[elementId] == info.kind) {
|
| return elementId;
|
| }
|
| }
|
|
|