PY-41923 Don't cache extensions of Pythonid.knownDecoratorProvider

GitOrigin-RevId: 91999f358b91e38d4014c8261a9ad7f247638c88
This commit is contained in:
Mikhail Golubev
2020-04-29 22:04:28 +00:00
committed by intellij-monorepo-bot
parent 267352c40e
commit bb0c52a8c8
4 changed files with 5 additions and 10 deletions
@@ -21,7 +21,9 @@
<extensionPoint qualifiedName="Pythonid.pyModuleMembersProvider"
interface="com.jetbrains.python.psi.types.PyModuleMembersProvider"
dynamic="true"/>
<extensionPoint qualifiedName="Pythonid.knownDecoratorProvider" interface="com.jetbrains.python.psi.PyKnownDecoratorProvider"/>
<extensionPoint qualifiedName="Pythonid.knownDecoratorProvider"
interface="com.jetbrains.python.psi.PyKnownDecoratorProvider"
dynamic="true"/>
<extensionPoint qualifiedName="Pythonid.canonicalPathProvider"
interface="com.jetbrains.python.psi.resolve.PyCanonicalPathProvider"
dynamic="true"/>
@@ -958,13 +958,6 @@ public class PyUtil {
return variables;
}
public static class KnownDecoratorProviderHolder {
public static final List<PyKnownDecoratorProvider> KNOWN_DECORATOR_PROVIDERS = PyKnownDecoratorProvider.EP_NAME.getExtensionList();
private KnownDecoratorProviderHolder() {
}
}
/**
* If argument is a PsiDirectory, turn it into a PsiFile that points to __init__.py in that directory.
* If there's no __init__.py there, null is returned, there's no point to resolve to a dir which is not a package.
@@ -692,7 +692,7 @@ public class PyClassImpl extends PyBaseElementImpl<PyClassStub> implements PyCla
final QualifiedName qname = deco.getQualifiedName();
if (qname != null) {
String decoName = qname.toString();
for (PyKnownDecoratorProvider provider : PyUtil.KnownDecoratorProviderHolder.KNOWN_DECORATOR_PROVIDERS) {
for (PyKnownDecoratorProvider provider : PyKnownDecoratorProvider.EP_NAME.getExtensionList()) {
final String knownName = provider.toKnownDecorator(decoName);
if (knownName != null) {
decoName = knownName;
@@ -858,7 +858,7 @@ public class PyFunctionImpl extends PyBaseElementImpl<PyFunctionStub> implements
if (PyNames.CLASSMETHOD.equals(deconame) || PyNames.STATICMETHOD.equals(deconame)) {
return deconame;
}
for (PyKnownDecoratorProvider provider : PyUtil.KnownDecoratorProviderHolder.KNOWN_DECORATOR_PROVIDERS) {
for (PyKnownDecoratorProvider provider : PyKnownDecoratorProvider.EP_NAME.getIterable()) {
String name = provider.toKnownDecorator(deconame);
if (name != null) {
return name;