| 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 0d1970a1f15178e0f3a02863d9320b5a356eb595..a146312cc0b89486b135caff75d02c94a624f6a8 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
|
| @@ -85,208 +85,6 @@ class DartUnitContributorTest extends AbstractSingleUnitTest {
|
| });
|
| }
|
|
|
| - void test_NameElement_field() {
|
| - _indexTestUnit('''
|
| -class A {
|
| - int field;
|
| -}
|
| -main(A a, p) {
|
| - print(a.field); // r
|
| - print(p.field); // ur
|
| - {
|
| - var field = 42;
|
| - print(field); // not a member
|
| - }
|
| -}
|
| -''');
|
| - // prepare elements
|
| - Element mainElement = findElement('main');
|
| - FieldElement fieldElement = findElement('field');
|
| - Element nameElement = new NameElement('field');
|
| - // verify
|
| - _assertRecordedRelation(
|
| - nameElement,
|
| - IndexConstants.NAME_IS_DEFINED_BY,
|
| - _expectedLocation(fieldElement, 'field;'));
|
| - _assertRecordedRelation(
|
| - nameElement,
|
| - IndexConstants.IS_READ_BY,
|
| - _expectedLocationQ(mainElement, 'field); // r'));
|
| - _assertRecordedRelation(
|
| - nameElement,
|
| - IndexConstants.IS_READ_BY,
|
| - _expectedLocationQU(mainElement, 'field); // ur'));
|
| - _assertNoRecordedRelation(
|
| - nameElement,
|
| - IndexConstants.IS_READ_BY,
|
| - _expectedLocation(mainElement, 'field); // not a member'));
|
| - }
|
| -
|
| - void test_NameElement_isDefinedBy_localVariable_inForEach() {
|
| - _indexTestUnit('''
|
| -class A {
|
| - main() {
|
| - for (int test in []) {
|
| - }
|
| - }
|
| -}
|
| -''');
|
| - // prepare elements
|
| - LocalVariableElement testElement = findElement('test');
|
| - Element nameElement = new NameElement('test');
|
| - // verify
|
| - _assertRecordedRelation(
|
| - nameElement,
|
| - IndexConstants.NAME_IS_DEFINED_BY,
|
| - _expectedLocation(testElement, 'test in []'));
|
| - }
|
| -
|
| - void test_NameElement_method() {
|
| - _indexTestUnit('''
|
| -class A {
|
| - method() {}
|
| -}
|
| -main(A a, p) {
|
| - a.method(); // r
|
| - p.method(); // ur
|
| -}
|
| -''');
|
| - // prepare elements
|
| - Element mainElement = findElement('main');
|
| - MethodElement methodElement = findElement('method');
|
| - Element nameElement = new NameElement('method');
|
| - // verify
|
| - _assertRecordedRelation(
|
| - nameElement,
|
| - IndexConstants.NAME_IS_DEFINED_BY,
|
| - _expectedLocation(methodElement, 'method() {}'));
|
| - _assertRecordedRelation(
|
| - nameElement,
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQ(mainElement, 'method(); // r'));
|
| - _assertRecordedRelation(
|
| - nameElement,
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQU(mainElement, 'method(); // ur'));
|
| - }
|
| -
|
| - void test_NameElement_operator_resolved() {
|
| - _indexTestUnit('''
|
| -class A {
|
| - operator +(o) {}
|
| - operator -(o) {}
|
| - operator ~() {}
|
| - operator ==(o) {}
|
| -}
|
| -main(A a) {
|
| - a + 5;
|
| - a += 5;
|
| - a == 5;
|
| - ++a;
|
| - --a;
|
| - ~a;
|
| - a++;
|
| - a--;
|
| -}
|
| -''');
|
| - // prepare elements
|
| - Element mainElement = findElement('main');
|
| - // binary
|
| - _assertRecordedRelation(
|
| - new NameElement('+'),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQ(mainElement, '+ 5', length: 1));
|
| - _assertRecordedRelation(
|
| - new NameElement('+'),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQ(mainElement, '+= 5', length: 2));
|
| - _assertRecordedRelation(
|
| - new NameElement('=='),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQ(mainElement, '== 5', length: 2));
|
| - // prefix
|
| - _assertRecordedRelation(
|
| - new NameElement('+'),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQ(mainElement, '++a', length: 2));
|
| - _assertRecordedRelation(
|
| - new NameElement('-'),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQ(mainElement, '--a', length: 2));
|
| - _assertRecordedRelation(
|
| - new NameElement('~'),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQ(mainElement, '~a', length: 1));
|
| - // postfix
|
| - _assertRecordedRelation(
|
| - new NameElement('+'),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQ(mainElement, '++;', length: 2));
|
| - _assertRecordedRelation(
|
| - new NameElement('-'),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQ(mainElement, '--;', length: 2));
|
| - }
|
| -
|
| -
|
| - void test_NameElement_operator_unresolved() {
|
| - _indexTestUnit('''
|
| -class A {
|
| - operator +(o) {}
|
| - operator -(o) {}
|
| - operator ~() {}
|
| - operator ==(o) {}
|
| -}
|
| -main(a) {
|
| - a + 5;
|
| - a += 5;
|
| - a == 5;
|
| - ++a;
|
| - --a;
|
| - ~a;
|
| - a++;
|
| - a--;
|
| -}
|
| -''');
|
| - // prepare elements
|
| - Element mainElement = findElement('main');
|
| - // binary
|
| - _assertRecordedRelation(
|
| - new NameElement('+'),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQU(mainElement, '+ 5', length: 1));
|
| - _assertRecordedRelation(
|
| - new NameElement('+'),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQU(mainElement, '+= 5', length: 2));
|
| - _assertRecordedRelation(
|
| - new NameElement('=='),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQU(mainElement, '== 5', length: 2));
|
| - // prefix
|
| - _assertRecordedRelation(
|
| - new NameElement('+'),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQU(mainElement, '++a', length: 2));
|
| - _assertRecordedRelation(
|
| - new NameElement('-'),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQU(mainElement, '--a', length: 2));
|
| - _assertRecordedRelation(
|
| - new NameElement('~'),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQU(mainElement, '~a', length: 1));
|
| - // postfix
|
| - _assertRecordedRelation(
|
| - new NameElement('+'),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQU(mainElement, '++;', length: 2));
|
| - _assertRecordedRelation(
|
| - new NameElement('-'),
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocationQU(mainElement, '--;', length: 2));
|
| - }
|
| -
|
| void test_definesClass() {
|
| _indexTestUnit('class A {}');
|
| // prepare elements
|
| @@ -297,16 +95,6 @@ main(a) {
|
| _expectedLocation(classElement, 'A {}'));
|
| }
|
|
|
| - void test_definesClassEnum() {
|
| - _indexTestUnit('enum MyEnum {A, B, c}');
|
| - // prepare elements
|
| - ClassElement classElement = findElement("MyEnum");
|
| - // verify
|
| - _assertDefinesTopLevelElement(
|
| - IndexConstants.DEFINES,
|
| - _expectedLocation(classElement, 'MyEnum {'));
|
| - }
|
| -
|
| void test_definesClassAlias() {
|
| _indexTestUnit('''
|
| class Mix {}
|
| @@ -319,6 +107,16 @@ class MyClass = Object with Mix;''');
|
| _expectedLocation(classElement, 'MyClass ='));
|
| }
|
|
|
| + void test_definesClassEnum() {
|
| + _indexTestUnit('enum MyEnum {A, B, c}');
|
| + // prepare elements
|
| + ClassElement classElement = findElement("MyEnum");
|
| + // verify
|
| + _assertDefinesTopLevelElement(
|
| + IndexConstants.DEFINES,
|
| + _expectedLocation(classElement, 'MyEnum {'));
|
| + }
|
| +
|
| void test_definesFunction() {
|
| _indexTestUnit('myFunction() {}');
|
| // prepare elements
|
| @@ -404,6 +202,7 @@ class A {
|
| _expectedLocation(methodElement, 'm() {}'));
|
| }
|
|
|
| +
|
| void test_isDefinedBy_NameElement_operator() {
|
| _indexTestUnit('''
|
| class A {
|
| @@ -419,7 +218,6 @@ class A {
|
| _expectedLocation(methodElement, '+(o) {}', length: 1));
|
| }
|
|
|
| -
|
| void test_isExtendedBy_ClassDeclaration() {
|
| _indexTestUnit('''
|
| class A {} // 1
|
| @@ -449,7 +247,6 @@ class A {} // 1
|
| _expectedLocation(classElementA, 'A {}', length: 0));
|
| }
|
|
|
| -
|
| void test_isExtendedBy_ClassTypeAlias() {
|
| _indexTestUnit('''
|
| class A {} // 1
|
| @@ -497,6 +294,7 @@ class C = Object with A implements B; // 3
|
| _expectedLocation(classElementC, 'B; // 3'));
|
| }
|
|
|
| +
|
| void test_isInvokedBy_FieldElement() {
|
| _indexTestUnit('''
|
| class A {
|
| @@ -547,6 +345,7 @@ main() {
|
| _expectedLocation(mainElement, 'foo(); // nq'));
|
| }
|
|
|
| +
|
| void test_isInvokedBy_LocalVariableElement() {
|
| _indexTestUnit('''
|
| main() {
|
| @@ -606,21 +405,6 @@ main() {
|
| _expectedLocationQ(mainElement, 'foo();'));
|
| }
|
|
|
| - void test_isInvokedBy_ParameterElement() {
|
| - _indexTestUnit('''
|
| -main(p()) {
|
| - p();
|
| -}''');
|
| - // prepare elements
|
| - Element mainElement = findElement("main");
|
| - Element element = findElement("p");
|
| - // verify
|
| - _assertRecordedRelation(
|
| - element,
|
| - IndexConstants.IS_INVOKED_BY,
|
| - _expectedLocation(mainElement, 'p();'));
|
| - }
|
| -
|
| void test_isInvokedBy_operator_binary() {
|
| _indexTestUnit('''
|
| class A {
|
| @@ -700,18 +484,33 @@ main(A a) {
|
| _expectedLocationQ(mainElement, '~a', length: 1));
|
| }
|
|
|
| - void test_isMixedInBy_ClassDeclaration() {
|
| + void test_isInvokedBy_ParameterElement() {
|
| _indexTestUnit('''
|
| -class A {} // 1
|
| -class B extends Object with A {} // 2
|
| -''');
|
| +main(p()) {
|
| + p();
|
| +}''');
|
| // prepare elements
|
| - ClassElement classElementA = findElement("A");
|
| - ClassElement classElementB = findElement("B");
|
| + Element mainElement = findElement("main");
|
| + Element element = findElement("p");
|
| // verify
|
| _assertRecordedRelation(
|
| - classElementA,
|
| - IndexConstants.IS_MIXED_IN_BY,
|
| + element,
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocation(mainElement, 'p();'));
|
| + }
|
| +
|
| + void test_isMixedInBy_ClassDeclaration() {
|
| + _indexTestUnit('''
|
| +class A {} // 1
|
| +class B extends Object with A {} // 2
|
| +''');
|
| + // prepare elements
|
| + ClassElement classElementA = findElement("A");
|
| + ClassElement classElementB = findElement("B");
|
| + // verify
|
| + _assertRecordedRelation(
|
| + classElementA,
|
| + IndexConstants.IS_MIXED_IN_BY,
|
| _expectedLocation(classElementB, 'A {} // 2'));
|
| }
|
|
|
| @@ -1105,6 +904,33 @@ main(A p) {
|
| _expectedLocation(pElement, 'A p) {'));
|
| }
|
|
|
| + /**
|
| + * There was a bug in the AST structure, when single [Comment] was cloned and
|
| + * assigned to both [FieldDeclaration] and [VariableDeclaration].
|
| + *
|
| + * This caused duplicate indexing.
|
| + * Here we test that the problem is fixed one way or another.
|
| + */
|
| + void test_isReferencedBy_identifierInComment() {
|
| + _indexTestUnit('''
|
| +class A {}
|
| +/// [A] text
|
| +var myVariable = null;
|
| +''');
|
| + // prepare elements
|
| + Element aElement = findElement('A');
|
| + Element variableElement = findElement('myVariable');
|
| + // verify
|
| + _assertRecordedRelation(
|
| + aElement,
|
| + IndexConstants.IS_REFERENCED_BY,
|
| + _expectedLocation(testUnitElement, 'A] text'));
|
| + _assertNoRecordedRelation(
|
| + aElement,
|
| + IndexConstants.IS_REFERENCED_BY,
|
| + _expectedLocation(variableElement, 'A] text'));
|
| + }
|
| +
|
| void test_isReferencedBy_ImportElement_noPrefix() {
|
| addSource('/lib.dart', '''
|
| library lib;
|
| @@ -1307,6 +1133,24 @@ main() {
|
| _expectedLocation(mainElement, 'L;'));
|
| }
|
|
|
| + void test_isReferencedBy_libraryName() {
|
| + Source libSource = addSource('/lib.dart', '''
|
| +library lib;
|
| +part 'test.dart';
|
| +''');
|
| + testCode = 'part of lib;';
|
| + testSource = addSource('/test.dart', testCode);
|
| + testUnit = resolveDartUnit(testSource, libSource);
|
| + testUnitElement = testUnit.element;
|
| + testLibraryElement = testUnitElement.library;
|
| + indexDartUnit(store, context, testUnit);
|
| + // verify
|
| + _assertRecordedRelation(
|
| + testLibraryElement,
|
| + IndexConstants.IS_REFERENCED_BY,
|
| + _expectedLocation(testUnitElement, "lib;"));
|
| + }
|
| +
|
| void test_isReferencedBy_MethodElement() {
|
| _indexTestUnit('''
|
| class A {
|
| @@ -1411,6 +1255,21 @@ main() {
|
| _expectedLocation(mainElement, 'V); // nq'));
|
| }
|
|
|
| + void test_isReferencedBy_typeInVariableList() {
|
| + _indexTestUnit('''
|
| +class A {}
|
| +A myVariable = null;
|
| +''');
|
| + // prepare elements
|
| + Element classElementA = findElement('A');
|
| + Element variableElement = findElement('myVariable');
|
| + // verify
|
| + _assertRecordedRelation(
|
| + classElementA,
|
| + IndexConstants.IS_REFERENCED_BY,
|
| + _expectedLocation(variableElement, 'A myVariable'));
|
| + }
|
| +
|
| void test_isReferencedBy_TypeParameterElement() {
|
| _indexTestUnit('''
|
| class A<T> {
|
| @@ -1440,66 +1299,6 @@ class A<T> {
|
| _expectedLocation(variableElement, 'T v'));
|
| }
|
|
|
| - /**
|
| - * There was a bug in the AST structure, when single [Comment] was cloned and
|
| - * assigned to both [FieldDeclaration] and [VariableDeclaration].
|
| - *
|
| - * This caused duplicate indexing.
|
| - * Here we test that the problem is fixed one way or another.
|
| - */
|
| - void test_isReferencedBy_identifierInComment() {
|
| - _indexTestUnit('''
|
| -class A {}
|
| -/// [A] text
|
| -var myVariable = null;
|
| -''');
|
| - // prepare elements
|
| - Element aElement = findElement('A');
|
| - Element variableElement = findElement('myVariable');
|
| - // verify
|
| - _assertRecordedRelation(
|
| - aElement,
|
| - IndexConstants.IS_REFERENCED_BY,
|
| - _expectedLocation(testUnitElement, 'A] text'));
|
| - _assertNoRecordedRelation(
|
| - aElement,
|
| - IndexConstants.IS_REFERENCED_BY,
|
| - _expectedLocation(variableElement, 'A] text'));
|
| - }
|
| -
|
| - void test_isReferencedBy_libraryName() {
|
| - Source libSource = addSource('/lib.dart', '''
|
| -library lib;
|
| -part 'test.dart';
|
| -''');
|
| - testCode = 'part of lib;';
|
| - testSource = addSource('/test.dart', testCode);
|
| - testUnit = resolveDartUnit(testSource, libSource);
|
| - testUnitElement = testUnit.element;
|
| - testLibraryElement = testUnitElement.library;
|
| - indexDartUnit(store, context, testUnit);
|
| - // verify
|
| - _assertRecordedRelation(
|
| - testLibraryElement,
|
| - IndexConstants.IS_REFERENCED_BY,
|
| - _expectedLocation(testUnitElement, "lib;"));
|
| - }
|
| -
|
| - void test_isReferencedBy_typeInVariableList() {
|
| - _indexTestUnit('''
|
| -class A {}
|
| -A myVariable = null;
|
| -''');
|
| - // prepare elements
|
| - Element classElementA = findElement('A');
|
| - Element variableElement = findElement('myVariable');
|
| - // verify
|
| - _assertRecordedRelation(
|
| - classElementA,
|
| - IndexConstants.IS_REFERENCED_BY,
|
| - _expectedLocation(variableElement, 'A myVariable'));
|
| - }
|
| -
|
| void test_isWrittenBy_ParameterElement() {
|
| _indexTestUnit('''
|
| main(var p) {
|
| @@ -1531,6 +1330,207 @@ main() {
|
| _expectedLocation(mainElement, 'v = 1'));
|
| }
|
|
|
| + void test_NameElement_field() {
|
| + _indexTestUnit('''
|
| +class A {
|
| + int field;
|
| +}
|
| +main(A a, p) {
|
| + print(a.field); // r
|
| + print(p.field); // ur
|
| + {
|
| + var field = 42;
|
| + print(field); // not a member
|
| + }
|
| +}
|
| +''');
|
| + // prepare elements
|
| + Element mainElement = findElement('main');
|
| + FieldElement fieldElement = findElement('field');
|
| + Element nameElement = new NameElement('field');
|
| + // verify
|
| + _assertRecordedRelation(
|
| + nameElement,
|
| + IndexConstants.NAME_IS_DEFINED_BY,
|
| + _expectedLocation(fieldElement, 'field;'));
|
| + _assertRecordedRelation(
|
| + nameElement,
|
| + IndexConstants.IS_READ_BY,
|
| + _expectedLocationQ(mainElement, 'field); // r'));
|
| + _assertRecordedRelation(
|
| + nameElement,
|
| + IndexConstants.IS_READ_BY,
|
| + _expectedLocationQU(mainElement, 'field); // ur'));
|
| + _assertNoRecordedRelation(
|
| + nameElement,
|
| + IndexConstants.IS_READ_BY,
|
| + _expectedLocation(mainElement, 'field); // not a member'));
|
| + }
|
| +
|
| + void test_NameElement_isDefinedBy_localVariable_inForEach() {
|
| + _indexTestUnit('''
|
| +class A {
|
| + main() {
|
| + for (int test in []) {
|
| + }
|
| + }
|
| +}
|
| +''');
|
| + // prepare elements
|
| + LocalVariableElement testElement = findElement('test');
|
| + Element nameElement = new NameElement('test');
|
| + // verify
|
| + _assertRecordedRelation(
|
| + nameElement,
|
| + IndexConstants.NAME_IS_DEFINED_BY,
|
| + _expectedLocation(testElement, 'test in []'));
|
| + }
|
| +
|
| + void test_NameElement_method() {
|
| + _indexTestUnit('''
|
| +class A {
|
| + method() {}
|
| +}
|
| +main(A a, p) {
|
| + a.method(); // r
|
| + p.method(); // ur
|
| +}
|
| +''');
|
| + // prepare elements
|
| + Element mainElement = findElement('main');
|
| + MethodElement methodElement = findElement('method');
|
| + Element nameElement = new NameElement('method');
|
| + // verify
|
| + _assertRecordedRelation(
|
| + nameElement,
|
| + IndexConstants.NAME_IS_DEFINED_BY,
|
| + _expectedLocation(methodElement, 'method() {}'));
|
| + _assertRecordedRelation(
|
| + nameElement,
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQ(mainElement, 'method(); // r'));
|
| + _assertRecordedRelation(
|
| + nameElement,
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQU(mainElement, 'method(); // ur'));
|
| + }
|
| +
|
| + void test_NameElement_operator_resolved() {
|
| + _indexTestUnit('''
|
| +class A {
|
| + operator +(o) {}
|
| + operator -(o) {}
|
| + operator ~() {}
|
| + operator ==(o) {}
|
| +}
|
| +main(A a) {
|
| + a + 5;
|
| + a += 5;
|
| + a == 5;
|
| + ++a;
|
| + --a;
|
| + ~a;
|
| + a++;
|
| + a--;
|
| +}
|
| +''');
|
| + // prepare elements
|
| + Element mainElement = findElement('main');
|
| + // binary
|
| + _assertRecordedRelation(
|
| + new NameElement('+'),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQ(mainElement, '+ 5', length: 1));
|
| + _assertRecordedRelation(
|
| + new NameElement('+'),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQ(mainElement, '+= 5', length: 2));
|
| + _assertRecordedRelation(
|
| + new NameElement('=='),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQ(mainElement, '== 5', length: 2));
|
| + // prefix
|
| + _assertRecordedRelation(
|
| + new NameElement('+'),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQ(mainElement, '++a', length: 2));
|
| + _assertRecordedRelation(
|
| + new NameElement('-'),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQ(mainElement, '--a', length: 2));
|
| + _assertRecordedRelation(
|
| + new NameElement('~'),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQ(mainElement, '~a', length: 1));
|
| + // postfix
|
| + _assertRecordedRelation(
|
| + new NameElement('+'),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQ(mainElement, '++;', length: 2));
|
| + _assertRecordedRelation(
|
| + new NameElement('-'),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQ(mainElement, '--;', length: 2));
|
| + }
|
| +
|
| + void test_NameElement_operator_unresolved() {
|
| + _indexTestUnit('''
|
| +class A {
|
| + operator +(o) {}
|
| + operator -(o) {}
|
| + operator ~() {}
|
| + operator ==(o) {}
|
| +}
|
| +main(a) {
|
| + a + 5;
|
| + a += 5;
|
| + a == 5;
|
| + ++a;
|
| + --a;
|
| + ~a;
|
| + a++;
|
| + a--;
|
| +}
|
| +''');
|
| + // prepare elements
|
| + Element mainElement = findElement('main');
|
| + // binary
|
| + _assertRecordedRelation(
|
| + new NameElement('+'),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQU(mainElement, '+ 5', length: 1));
|
| + _assertRecordedRelation(
|
| + new NameElement('+'),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQU(mainElement, '+= 5', length: 2));
|
| + _assertRecordedRelation(
|
| + new NameElement('=='),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQU(mainElement, '== 5', length: 2));
|
| + // prefix
|
| + _assertRecordedRelation(
|
| + new NameElement('+'),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQU(mainElement, '++a', length: 2));
|
| + _assertRecordedRelation(
|
| + new NameElement('-'),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQU(mainElement, '--a', length: 2));
|
| + _assertRecordedRelation(
|
| + new NameElement('~'),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQU(mainElement, '~a', length: 1));
|
| + // postfix
|
| + _assertRecordedRelation(
|
| + new NameElement('+'),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQU(mainElement, '++;', length: 2));
|
| + _assertRecordedRelation(
|
| + new NameElement('-'),
|
| + IndexConstants.IS_INVOKED_BY,
|
| + _expectedLocationQU(mainElement, '--;', length: 2));
|
| + }
|
| +
|
| void test_nameIsInvokedBy() {
|
| _indexTestUnit('''
|
| class A {
|
|
|