@NotNull private static List<RatedResolveResult> resolveModuleMember( @NotNull PyFile file, @NotNull String referencedName) { final PyModuleType moduleType = new PyModuleType(file); final PyResolveContext resolveContext = PyResolveContext.defaultContext(); final List<? extends RatedResolveResult> results = moduleType.resolveMember(referencedName, null, AccessDirection.READ, resolveContext); if (results == null) { return Collections.emptyList(); } return Lists.newArrayList(results); }
@NotNull private static List<RatedResolveResult> resolveMemberFromReferenceTypeProviders( @NotNull PsiElement parent, @NotNull String referencedName) { final PyResolveContext resolveContext = PyResolveContext.defaultContext(); final PyType refType = PyReferenceExpressionImpl.getReferenceTypeFromProviders( parent, resolveContext.getTypeEvalContext(), null); if (refType != null) { final List<? extends RatedResolveResult> result = refType.resolveMember(referencedName, null, AccessDirection.READ, resolveContext); if (result != null) { return Lists.newArrayList(result); } } return Collections.emptyList(); }
@NotNull @Override public PsiPolyVariantReference getReference() { return getReference(PyResolveContext.defaultContext()); }