use of org.jetbrains.plugins.groovy.lang.resolve.delegatesTo.DelegatesToInfo in project intellij-community by JetBrains.
the class GrClosureDelegateTypeCalculator method calculateType.
@Nullable
protected PsiType calculateType(@NotNull GrExpression expression, @NotNull PsiMethod method) {
if (!"getDelegate".equals(method.getName()) || method.getParameterList().getParametersCount() != 0)
return null;
final GrClosableBlock closure = PsiTreeUtil.getParentOfType(expression, GrClosableBlock.class);
if (closure == null)
return null;
final PsiClass closureClass = JavaPsiFacade.getInstance(expression.getProject()).findClass(GroovyCommonClassNames.GROOVY_LANG_CLOSURE, expression.getResolveScope());
if (closureClass == null || !closureClass.equals(method.getContainingClass()))
return null;
final DelegatesToInfo info = GrDelegatesToUtilKt.getDelegatesToInfo(closure);
if (info == null)
return null;
return info.getTypeToDelegate();
}
Aggregations