Search in sources :

Example 1 with CustomTargetExpressionStub

use of com.jetbrains.python.psi.impl.stubs.CustomTargetExpressionStub in project intellij-community by JetBrains.

the class PyTargetExpressionImpl method getCalleeName.

@Override
public QualifiedName getCalleeName() {
    final PyTargetExpressionStub stub = getStub();
    if (stub != null) {
        final PyTargetExpressionStub.InitializerType initializerType = stub.getInitializerType();
        if (initializerType == PyTargetExpressionStub.InitializerType.CallExpression) {
            return stub.getInitializer();
        } else if (initializerType == PyTargetExpressionStub.InitializerType.Custom) {
            final CustomTargetExpressionStub customStub = stub.getCustomStub(CustomTargetExpressionStub.class);
            if (customStub != null) {
                return customStub.getCalleeName();
            }
        }
        return null;
    }
    final PyExpression value = findAssignedValue();
    if (value instanceof PyCallExpression) {
        final PyExpression callee = ((PyCallExpression) value).getCallee();
        return PyPsiUtils.asQualifiedName(callee);
    }
    return null;
}
Also used : CustomTargetExpressionStub(com.jetbrains.python.psi.impl.stubs.CustomTargetExpressionStub) PyTargetExpressionStub(com.jetbrains.python.psi.stubs.PyTargetExpressionStub)

Aggregations

CustomTargetExpressionStub (com.jetbrains.python.psi.impl.stubs.CustomTargetExpressionStub)1 PyTargetExpressionStub (com.jetbrains.python.psi.stubs.PyTargetExpressionStub)1