don't shift text range if the element has no last child (PY-11344)

This commit is contained in:
Dmitry Jemerov
2013-11-08 13:42:04 +01:00
parent 9e3bbe98a9
commit 4ab17a05d0
@@ -561,13 +561,13 @@ public class PyUnresolvedReferencesInspection extends PyInspection {
final PsiElement point;
final TextRange range;
if (reference instanceof PyOperatorReference) {
final PsiElement lastChild = node.getLastChild();
if (reference instanceof PyOperatorReference || lastChild == null) {
point = node;
range = rangeInElement;
}
else {
final PsiElement lastChild = node.getLastChild();
point = lastChild != null ? lastChild : node; // usually the identifier at the end of qual ref
point = lastChild; // usually the identifier at the end of qual ref
range = rangeInElement.shiftRight(-point.getStartOffsetInParent());
}
if (reference instanceof PyImportReference && refname != null) {