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

Side by Side Diff: pkg/analyzer/test/src/dart/analysis/index_test.dart

Issue 2529433003: Fix for exception duirng indexing a reference to MultiplyDefinedElement. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/index.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/index.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698