use of com.jetbrains.python.psi.resolve.PyResolveContext in project intellij-community by JetBrains.
the class PyPackageUtil method resolveRequiresValue.
@Nullable
private static PyListLiteralExpression resolveRequiresValue(@NotNull Module module, @Nullable PyExpression requires) {
if (requires instanceof PyListLiteralExpression) {
return (PyListLiteralExpression) requires;
}
if (requires instanceof PyReferenceExpression) {
final TypeEvalContext context = TypeEvalContext.deepCodeInsight(module.getProject());
final PyResolveContext resolveContext = PyResolveContext.noImplicits().withTypeEvalContext(context);
final QualifiedResolveResult result = ((PyReferenceExpression) requires).followAssignmentsChain(resolveContext);
final PsiElement element = result.getElement();
if (element instanceof PyListLiteralExpression) {
return (PyListLiteralExpression) element;
}
}
return null;
}
use of com.jetbrains.python.psi.resolve.PyResolveContext in project intellij-community by JetBrains.
the class PyDependentModuleMembersCollector method collect.
@Override
public void collect(final PsiNamedElement member) {
if (member.getContainingFile() == myModule) {
final PyResolveContext resolveContext = PyResolveContext.defaultContext();
final PsiElement memberBody = PyMoveModuleMembersHelper.expandNamedElementBody(member);
assert memberBody != null;
memberBody.accept(new PyRecursiveElementVisitor() {
@Override
public void visitElement(PsiElement element) {
for (PsiElement result : PyUtil.multiResolveTopPriority(element, resolveContext)) {
if (result != null && isValidSameModuleDependency(result) && result != member) {
myCollection.add((PsiNamedElement) result);
}
}
super.visitElement(element);
}
});
}
}
Aggregations