use of org.jetbrains.plugins.groovy.lang.resolve.processors.PropertyResolverProcessor in project intellij-community by JetBrains.
the class GrDocFieldReferenceImpl method multiResolveImpl.
@Override
protected ResolveResult[] multiResolveImpl() {
String name = getReferenceName();
GrDocReferenceElement holder = getReferenceHolder();
PsiElement resolved;
if (holder != null) {
GrCodeReferenceElement referenceElement = holder.getReferenceElement();
resolved = referenceElement != null ? referenceElement.resolve() : null;
} else {
resolved = PsiUtil.getContextClass(GrDocCommentUtil.findDocOwner(this));
}
if (resolved instanceof PsiClass) {
PropertyResolverProcessor processor = new PropertyResolverProcessor(name, this);
resolved.processDeclarations(processor, ResolveState.initial(), resolved, this);
GroovyResolveResult[] candidates = processor.getCandidates();
if (candidates.length == 0) {
PsiType thisType = JavaPsiFacade.getInstance(getProject()).getElementFactory().createType((PsiClass) resolved, PsiSubstitutor.EMPTY);
MethodResolverProcessor methodProcessor = new MethodResolverProcessor(name, this, false, thisType, null, PsiType.EMPTY_ARRAY);
MethodResolverProcessor constructorProcessor = new MethodResolverProcessor(name, this, true, thisType, null, PsiType.EMPTY_ARRAY);
resolved.processDeclarations(methodProcessor, ResolveState.initial(), resolved, this);
resolved.processDeclarations(constructorProcessor, ResolveState.initial(), resolved, this);
candidates = ArrayUtil.mergeArrays(methodProcessor.getCandidates(), constructorProcessor.getCandidates());
if (candidates.length > 0) {
candidates = new GroovyResolveResult[] { candidates[0] };
}
}
return candidates;
}
return ResolveResult.EMPTY_ARRAY;
}
use of org.jetbrains.plugins.groovy.lang.resolve.processors.PropertyResolverProcessor in project intellij-community by JetBrains.
the class ControlFlowBuilderUtil method resolveNonQualifiedRefWithoutFlow.
@NotNull
public static GroovyResolveResult[] resolveNonQualifiedRefWithoutFlow(@NotNull GrReferenceExpression ref) {
LOG.assertTrue(!ref.isQualified());
final String referenceName = ref.getReferenceName();
final ResolverProcessor processor = new PropertyResolverProcessor(referenceName, ref);
treeWalkUp(ref, processor);
final GroovyResolveResult[] candidates = processor.getCandidates();
if (candidates.length != 0) {
return candidates;
}
return GroovyResolveResult.EMPTY_ARRAY;
}
Aggregations