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:async'; | 5 import 'dart:async'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 | 7 |
8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
10 import 'package:analyzer/src/dart/analysis/driver.dart'; | 10 import 'package:analyzer/src/dart/analysis/driver.dart'; |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 print(this.method); // q | 786 print(this.method); // q |
787 print(method); // nq | 787 print(method); // nq |
788 } | 788 } |
789 }'''); | 789 }'''); |
790 MethodElement element = findElement('method'); | 790 MethodElement element = findElement('method'); |
791 assertThat(element) | 791 assertThat(element) |
792 ..isReferencedAt('method); // q', true) | 792 ..isReferencedAt('method); // q', true) |
793 ..isReferencedAt('method); // nq', false); | 793 ..isReferencedAt('method); // nq', false); |
794 } | 794 } |
795 | 795 |
| 796 test_isReferencedBy_MultiplyDefinedElement() async { |
| 797 provider.newFile(_p('$testProject/a1.dart'), 'class A {}'); |
| 798 provider.newFile(_p('$testProject/a2.dart'), 'class A {}'); |
| 799 await _indexTestUnit(''' |
| 800 import 'a1.dart'; |
| 801 import 'a2.dart'; |
| 802 A v = null; |
| 803 '''); |
| 804 } |
| 805 |
796 test_isReferencedBy_ParameterElement() async { | 806 test_isReferencedBy_ParameterElement() async { |
797 await _indexTestUnit(''' | 807 await _indexTestUnit(''' |
798 foo({var p}) {} | 808 foo({var p}) {} |
799 main() { | 809 main() { |
800 foo(p: 1); | 810 foo(p: 1); |
801 } | 811 } |
802 '''); | 812 '''); |
803 Element element = findElement('p'); | 813 Element element = findElement('p'); |
804 assertThat(element)..isReferencedAt('p: 1', true); | 814 assertThat(element)..isReferencedAt('p: 1', true); |
805 } | 815 } |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 final bool isQualified; | 1231 final bool isQualified; |
1222 | 1232 |
1223 _Relation(this.kind, this.offset, this.length, this.isQualified); | 1233 _Relation(this.kind, this.offset, this.length, this.isQualified); |
1224 | 1234 |
1225 @override | 1235 @override |
1226 String toString() { | 1236 String toString() { |
1227 return '_Relation{kind: $kind, offset: $offset, length: $length, ' | 1237 return '_Relation{kind: $kind, offset: $offset, length: $length, ' |
1228 'isQualified: $isQualified}lified)'; | 1238 'isQualified: $isQualified}lified)'; |
1229 } | 1239 } |
1230 } | 1240 } |
OLD | NEW |