mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-18 20:41:22 +07:00
PY-34617 Move getTopLevelAttributes(), findTopLevelAttribute() from PyAstFile
GitOrigin-RevId: 226a7e968851ab0c8730bb79ca90d0ed5dcec364
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cfa28c0d2a
commit
16a7fb4b3e
@@ -17,7 +17,6 @@ package com.jetbrains.python.ast;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
import com.jetbrains.python.ast.controlFlow.AstScopeOwner;
|
||||
import com.jetbrains.python.ast.docstring.DocStringUtilCore;
|
||||
import com.jetbrains.python.psi.FutureFeature;
|
||||
@@ -41,13 +40,6 @@ public interface PyAstFile extends PyAstElement, PsiFile, PyAstDocStringOwner, A
|
||||
return stmts;
|
||||
}
|
||||
|
||||
List<? extends PyAstTargetExpression> getTopLevelAttributes();
|
||||
|
||||
@Nullable
|
||||
default PyAstTargetExpression findTopLevelAttribute(@NotNull String name) {
|
||||
return findByName(name, getTopLevelAttributes());
|
||||
}
|
||||
|
||||
LanguageLevel getLanguageLevel();
|
||||
|
||||
/**
|
||||
@@ -55,15 +47,6 @@ public interface PyAstFile extends PyAstElement, PsiFile, PyAstDocStringOwner, A
|
||||
*/
|
||||
boolean hasImportFromFuture(FutureFeature feature);
|
||||
|
||||
private static <T extends PsiNamedElement> T findByName(@NotNull String name, @NotNull List<T> namedElements) {
|
||||
for (T namedElement : namedElements) {
|
||||
if (name.equals(namedElement.getName())) {
|
||||
return namedElement;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
default boolean isAcceptedFor(@NotNull Class<?> visitorClass) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user