| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:convert'; | 5 import 'dart:convert'; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/src/summary/format.dart'; | 9 import 'package:analyzer/src/summary/format.dart'; |
| 10 import 'package:analyzer/src/summary/idl.dart'; | 10 import 'package:analyzer/src/summary/idl.dart'; |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 class A = B with M; | 533 class A = B with M; |
| 534 class B = A with M; | 534 class B = A with M; |
| 535 main() { | 535 main() { |
| 536 new A(); | 536 new A(); |
| 537 new B(); | 537 new B(); |
| 538 } | 538 } |
| 539 '''); | 539 '''); |
| 540 // No additional validation, but it should not fail with stack overflow. | 540 // No additional validation, but it should not fail with stack overflow. |
| 541 } | 541 } |
| 542 | 542 |
| 543 void test_isReferencedBy_ConstructorElement_namedOnlyWithDot() { |
| 544 _indexTestUnit(''' |
| 545 class A { |
| 546 A.named() {} |
| 547 } |
| 548 main() { |
| 549 new A.named(); |
| 550 } |
| 551 '''); |
| 552 // has ".named()", but does not have "named()" |
| 553 int offsetWithoutDot = findOffset('named();'); |
| 554 int offsetWithDot = findOffset('.named();'); |
| 555 expect(unitIndex.usedElementOffsets, isNot(contains(offsetWithoutDot))); |
| 556 expect(unitIndex.usedElementOffsets, contains(offsetWithDot)); |
| 557 } |
| 558 |
| 543 void test_isReferencedBy_ConstructorElement_redirection() { | 559 void test_isReferencedBy_ConstructorElement_redirection() { |
| 544 _indexTestUnit(''' | 560 _indexTestUnit(''' |
| 545 class A { | 561 class A { |
| 546 A() : this.bar(); // 1 | 562 A() : this.bar(); // 1 |
| 547 A.foo() : this(); // 2 | 563 A.foo() : this(); // 2 |
| 548 A.bar(); | 564 A.bar(); |
| 549 } | 565 } |
| 550 '''); | 566 '''); |
| 551 ClassElement classA = findElement('A'); | 567 ClassElement classA = findElement('A'); |
| 552 ConstructorElement constA = classA.constructors[0]; | 568 ConstructorElement constA = classA.constructors[0]; |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 void isNotReferencedAt(String search, {int length}) { | 943 void isNotReferencedAt(String search, {int length}) { |
| 928 test._assertUsedName(name, IndexRelationKind.IS_REFERENCED_BY, | 944 test._assertUsedName(name, IndexRelationKind.IS_REFERENCED_BY, |
| 929 test._expectedLocation(search, true, length: length), true); | 945 test._expectedLocation(search, true, length: length), true); |
| 930 } | 946 } |
| 931 | 947 |
| 932 void isReferencedAt(String search, {int length}) { | 948 void isReferencedAt(String search, {int length}) { |
| 933 test._assertUsedName(name, IndexRelationKind.IS_REFERENCED_BY, | 949 test._assertUsedName(name, IndexRelationKind.IS_REFERENCED_BY, |
| 934 test._expectedLocation(search, true, length: length), false); | 950 test._expectedLocation(search, true, length: length), false); |
| 935 } | 951 } |
| 936 } | 952 } |
| OLD | NEW |