package ex11;

import org.objectweb.asm.Opcodes;

public record CallInfo(int instruction, long index, String caller, String callee, String callTarget) {
    public String invokeType() {
        return switch (instruction) {
            case Opcodes.INVOKEDYNAMIC -> "dynamic";
            case Opcodes.INVOKESTATIC -> "static";
            case Opcodes.INVOKEINTERFACE -> "interface";
            case Opcodes.INVOKESPECIAL -> "special";
            case Opcodes.INVOKEVIRTUAL -> "virtual";
            default -> throw new IllegalStateException("Not an INVOKE* bytecode instruction: " + instruction);
        };
    }
}
