Search in sources :

Example 1 with GroovyResolverProcessor

use of org.jetbrains.plugins.groovy.lang.resolve.processors.GroovyResolverProcessor in project intellij-community by JetBrains.

the class GdkMethodUtil method categoryIteration.

public static boolean categoryIteration(GrClosableBlock place, final PsiScopeProcessor processor, ResolveState state) {
    if (!ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY)) && !(processor instanceof GroovyResolverProcessor && ((GroovyResolverProcessor) processor).isPropertyResolve())) {
        return true;
    }
    final GrMethodCall call = checkMethodCall(place, USE);
    if (call == null)
        return true;
    final GrClosableBlock[] closures = call.getClosureArguments();
    GrExpression[] args = call.getExpressionArguments();
    if (!(placeEqualsSingleClosureArg(place, closures) || placeEqualsLastArg(place, args)))
        return true;
    if (!(call.resolveMethod() instanceof GrGdkMethod))
        return true;
    state = state.put(ClassHint.RESOLVE_CONTEXT, call);
    if ((args.length == 1 || args.length == 2 && placeEqualsLastArg(place, args))) {
        PsiType type = args[0].getType();
        if (type instanceof GrTupleType) {
            return processTypesFromTuple((GrTupleType) type, processor, state, place);
        }
    }
    return processTypesFomArgs(args, processor, state, place);
}
Also used : GrGdkMethod(org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrGdkMethod) GrMethodCall(org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall) GrClosableBlock(org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock) GroovyResolverProcessor(org.jetbrains.plugins.groovy.lang.resolve.processors.GroovyResolverProcessor) GrExpression(org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression) GrTupleType(org.jetbrains.plugins.groovy.lang.psi.impl.GrTupleType)

Aggregations

GrClosableBlock (org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock)1 GrExpression (org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression)1 GrMethodCall (org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall)1 GrGdkMethod (org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrGdkMethod)1 GrTupleType (org.jetbrains.plugins.groovy.lang.psi.impl.GrTupleType)1 GroovyResolverProcessor (org.jetbrains.plugins.groovy.lang.resolve.processors.GroovyResolverProcessor)1