mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -80,6 +80,11 @@ public class PyNames {
|
||||
public static final String SEQUENCE = "Sequence";
|
||||
public static final String MAPPING = "Mapping";
|
||||
|
||||
public static final String COMPLEX = "Complex";
|
||||
public static final String REAL = "Real";
|
||||
public static final String RATIONAL = "Rational";
|
||||
public static final String INTEGRAL = "Integral";
|
||||
|
||||
public static final String CONTAINS = "__contains__";
|
||||
public static final String HASH = "__hash__";
|
||||
public static final String ITER = "__iter__";
|
||||
@@ -328,7 +333,7 @@ public class PyNames {
|
||||
);
|
||||
|
||||
public static Set<String> BuiltinInterfaces = ImmutableSet.of(
|
||||
CALLABLE, HASHABLE, ITERABLE, ITERATOR, SIZED, CONTAINER, SEQUENCE, MAPPING
|
||||
CALLABLE, HASHABLE, ITERABLE, ITERATOR, SIZED, CONTAINER, SEQUENCE, MAPPING, COMPLEX, REAL, RATIONAL, INTEGRAL
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,9 +7,12 @@ import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.python.psi.impl.PyQualifiedName;
|
||||
import com.jetbrains.python.psi.resolve.QualifiedNameResolver;
|
||||
import com.jetbrains.python.psi.types.PyClassType;
|
||||
import com.jetbrains.python.psi.types.PyType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
@@ -24,8 +27,18 @@ public abstract class PyPsiFacade {
|
||||
@Nullable
|
||||
public abstract PyClass findClass(String qName);
|
||||
|
||||
@NotNull
|
||||
public abstract PyClassType createClassType(@NotNull PyClass pyClass, boolean isDefinition);
|
||||
|
||||
@Nullable
|
||||
public abstract String findShortestImportableName(PsiElement importer, VirtualFile targetFile);
|
||||
public abstract PyType createUnionType(@NotNull Collection<PyType> members);
|
||||
|
||||
@Nullable
|
||||
public abstract PyType createTupleType(@NotNull Collection<PyType> members, @NotNull PsiElement anchor);
|
||||
|
||||
@Nullable
|
||||
public abstract PyType parseTypeAnnotation(@NotNull String annotation, @NotNull PsiElement anchor);
|
||||
|
||||
@Nullable
|
||||
public abstract String findShortestImportableName(@NotNull VirtualFile targetFile, @NotNull PsiElement anchor);
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ public interface PyTypeProvider {
|
||||
PyType getReferenceType(@NotNull PsiElement referenceTarget, TypeEvalContext context, @Nullable PsiElement anchor);
|
||||
|
||||
@Nullable
|
||||
PyType getParameterType(PyNamedParameter param, final PyFunction func, TypeEvalContext context);
|
||||
PyType getParameterType(@NotNull PyNamedParameter param, @NotNull PyFunction func, @NotNull TypeEvalContext context);
|
||||
|
||||
@Nullable
|
||||
PyType getReturnType(PyFunction function, @Nullable PyQualifiedExpression callSite, TypeEvalContext context);
|
||||
PyType getReturnType(@NotNull PyFunction function, @Nullable PyQualifiedExpression callSite, @NotNull TypeEvalContext context);
|
||||
|
||||
@Nullable
|
||||
PyType getIterationType(PyClass iterable);
|
||||
|
||||
@@ -21,7 +21,7 @@ public abstract class PyModuleMembersProvider {
|
||||
public Collection<PyDynamicMember> getMembers(PyFile module, PointInImport point) {
|
||||
final VirtualFile vFile = module.getVirtualFile();
|
||||
if (vFile != null) {
|
||||
final String qName = PyPsiFacade.getInstance(module.getProject()).findShortestImportableName(module, vFile);
|
||||
final String qName = PyPsiFacade.getInstance(module.getProject()).findShortestImportableName(vFile, module);
|
||||
if (qName != null) {
|
||||
return getMembersByQName(module, qName);
|
||||
}
|
||||
|
||||
@@ -75,12 +75,12 @@ public class PyTypeProviderBase implements PyTypeProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PyType getParameterType(PyNamedParameter param, PyFunction func, TypeEvalContext context) {
|
||||
public PyType getParameterType(@NotNull PyNamedParameter param, @NotNull PyFunction func, @NotNull TypeEvalContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PyType getReturnType(PyFunction function, @Nullable PyQualifiedExpression callSite, TypeEvalContext context) {
|
||||
public PyType getReturnType(@NotNull PyFunction function, @Nullable PyQualifiedExpression callSite, @NotNull TypeEvalContext context) {
|
||||
ReturnTypeDescriptor descriptor;
|
||||
synchronized (myMethodToReturnTypeMap) {
|
||||
descriptor = myMethodToReturnTypeMap.get(function.getName());
|
||||
|
||||
Reference in New Issue
Block a user