package me.tomassetti.bytecode_generation.pushop; import me.tomassetti.bytecode_generation.BytecodeSequence; import org.objectweb.asm.MethodVisitor; import static org.objectweb.asm.Opcodes.ALOAD; /** * Push the "this" value in the stack. */ public class PushThis extends BytecodeSequence { public static final int LOCALVAR_INDEX_FOR_THIS_IN_METHOD = 0; private static PushThis INSTANCE = new PushThis(); private PushThis() { } public static PushThis getInstance() { return INSTANCE; } @Override public void operate(MethodVisitor mv) { mv.visitVarInsn(ALOAD, LOCALVAR_INDEX_FOR_THIS_IN_METHOD); } }