Fix for exception duirng indexing a reference to MultiplyDefinedElement.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2529433003 .
This commit is contained in:
Konstantin Shcheglov 2016-11-22 15:03:41 -08:00
parent ea94a5dcb0
commit 7ec65fb9ca
2 changed files with 11 additions and 0 deletions

View file

@ -426,6 +426,7 @@ class _IndexContributor extends GeneralizingAstVisitor {
ElementKind elementKind = element?.kind;
if (elementKind == null ||
elementKind == ElementKind.DYNAMIC ||
elementKind == ElementKind.ERROR ||
elementKind == ElementKind.LABEL ||
elementKind == ElementKind.LOCAL_VARIABLE ||
elementKind == ElementKind.PREFIX ||

View file

@ -793,6 +793,16 @@ class A {
..isReferencedAt('method); // nq', false);
}
test_isReferencedBy_MultiplyDefinedElement() async {
provider.newFile(_p('$testProject/a1.dart'), 'class A {}');
provider.newFile(_p('$testProject/a2.dart'), 'class A {}');
await _indexTestUnit('''
import 'a1.dart';
import 'a2.dart';
A v = null;
''');
}
test_isReferencedBy_ParameterElement() async {
await _indexTestUnit('''
foo({var p}) {}