diff --git a/python/psi-api/src/com/jetbrains/python/psi/PyClass.java b/python/psi-api/src/com/jetbrains/python/psi/PyClass.java index bdc69149a8d5..1e69ee5b02f5 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/PyClass.java +++ b/python/psi-api/src/com/jetbrains/python/psi/PyClass.java @@ -36,21 +36,73 @@ public interface PyClass extends PsiNameIdentifierOwner, PyStatement, NameDefine @NotNull PyStatementList getStatementList(); - @Nullable - PyArgumentList getSuperClassExpressionList(); - + /** + * Returns types of all ancestors from the hierarchy. + */ @NotNull - PyExpression[] getSuperClassExpressions(); + List getAncestorTypes(@NotNull TypeEvalContext context); + /** + * Returns only those ancestors from the hierarchy, that are resolved to PyClass PSI elements. + * + * @see #getAncestorTypes(TypeEvalContext) for the full list of ancestors. + */ @NotNull - PsiElement[] getSuperClassElements(); + List getAncestorClasses(@NotNull TypeEvalContext context); + /** + * Returns types of all ancestors from the hierarchy using the default type evaluation context. + * + * @see #getAncestorClasses(TypeEvalContext) if a more detailed TypeEvalContext is available. + */ + @NotNull + List getAncestorClasses(); + + /** + * Returns types of expressions in the super classes list. + * + * If no super classes are specified, returns the type of the implicit super class for old- and new-style classes. + * + * @see #getAncestorTypes(TypeEvalContext) for the full list of ancestors. + */ @NotNull List getSuperClassTypes(@NotNull TypeEvalContext context); + /** + * Returns only those super classes for expressions from the super classes list, that are resolved to PyClass PSI elements. + * + * If no super classes are specified, returns the implicit super class for old- and new-style classes. + * + * @see #getSuperClassTypes(TypeEvalContext) for the full list of super classes. + * @see #getAncestorTypes(TypeEvalContext) for the full list of ancestors. + */ @NotNull PyClass[] getSuperClasses(); + /** + * Returns a PSI element for the super classes list. + * + * Operates at the AST level. + */ + @Nullable + PyArgumentList getSuperClassExpressionList(); + + /** + * Returns PSI elements for the expressions in the super classes list. + * + * Operates at the AST level. + */ + @NotNull + PyExpression[] getSuperClassExpressions(); + + /** + * Returns resolved elements representing super classes from the super classes list. + * + * Operates at the AST level. + */ + @NotNull + PsiElement[] getSuperClassElements(); + @NotNull PyFunction[] getMethods(); @@ -111,18 +163,6 @@ public interface PyClass extends PsiNameIdentifierOwner, PyStatement, NameDefine */ boolean isNewStyleClass(); - @NotNull - List getAncestorClasses(); - - @NotNull - List getAncestorClasses(@NotNull TypeEvalContext context); - - /** - * Get a list of all ancestor types. - */ - @NotNull - List getAncestorTypes(@NotNull TypeEvalContext context); - /** * Scan properties in order of definition, until processor returns true for one of them. * @param processor to check properties