Search in sources :

Example 1 with AccessTarget

use of org.jetbrains.kotlin.cfg.pseudocode.instructions.eval.AccessTarget in project kotlin by JetBrains.

the class PseudocodeUtil method isThisOrNoDispatchReceiver.

// When deal with constructed object (not this) treat it like it's fully initialized
// Otherwise (this or access with empty receiver) access instruction should be handled as usual
public static boolean isThisOrNoDispatchReceiver(@NotNull AccessValueInstruction instruction, @NotNull BindingContext bindingContext) {
    if (instruction.getReceiverValues().isEmpty()) {
        return true;
    }
    AccessTarget accessTarget = instruction.getTarget();
    if (accessTarget instanceof AccessTarget.BlackBox)
        return false;
    assert accessTarget instanceof AccessTarget.Call : "AccessTarget.Declaration has no receivers and it's not BlackBox, so it should be Call";
    ResolvedCall<?> accessResolvedCall = ((AccessTarget.Call) accessTarget).getResolvedCall();
    return ResolvedCallUtilKt.hasThisOrNoDispatchReceiver(accessResolvedCall, bindingContext);
}
Also used : ResolvedCall(org.jetbrains.kotlin.resolve.calls.model.ResolvedCall) AccessTarget(org.jetbrains.kotlin.cfg.pseudocode.instructions.eval.AccessTarget)

Aggregations

AccessTarget (org.jetbrains.kotlin.cfg.pseudocode.instructions.eval.AccessTarget)1 ResolvedCall (org.jetbrains.kotlin.resolve.calls.model.ResolvedCall)1