mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-25794, PY-25491: prevent PyImportElementImpl iterateNames from unstubbing files
(cherry picked from commit 4b85d35)
This commit is contained in:
committed by
Andrey Vlasovskikh
parent
5d6c451033
commit
27ff928ed3
@@ -24,7 +24,6 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.stubs.IStubElementType;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.QualifiedName;
|
||||
import com.intellij.util.containers.EmptyIterable;
|
||||
import com.jetbrains.python.PyElementTypes;
|
||||
import com.jetbrains.python.PythonDialectsTokenSetProvider;
|
||||
import com.jetbrains.python.psi.*;
|
||||
@@ -180,19 +179,15 @@ public class PyImportElementImpl extends PyBaseElementImpl<PyImportElementStub>
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getVisibleName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Iterable<PyElement> iterateNames() {
|
||||
PyElement ret = getAsNameElement();
|
||||
if (ret == null) {
|
||||
final PyReferenceExpression importReference = getImportReferenceExpression();
|
||||
if (importReference != null) {
|
||||
ret = PyPsiUtils.getFirstQualifier(importReference);
|
||||
}
|
||||
}
|
||||
if (ret == null) {
|
||||
return EmptyIterable.getInstance();
|
||||
}
|
||||
return Collections.singleton(ret);
|
||||
final String visibleName = getVisibleName();
|
||||
return visibleName != null ? Collections.singletonList(this) : Collections.emptyList();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user