Ejemplo n.º 1
0
def JUMP_FORWARD(ctx: _VSContext, instruction: dis.Instruction):
    """
    Jumps forward to the specified instruction.
    """
    ctx.instruction_pointer = get_instruction_index_by_offset(ctx, instruction)

    return ctx
Ejemplo n.º 2
0
def POP_JUMP_IF_FALSE(ctx: _VSContext, instruction: dis.Instruction):
    """
    Jumps to the specified instruction if False-y is on the top of the stack.
    """
    i = ctx.pop()
    if i:
        # Truthy, don't jump.
        return ctx

    # Jump!
    ctx.instruction_pointer = get_instruction_index_by_offset(ctx, instruction)

    return ctx
Ejemplo n.º 3
0
def POP_JUMP_IF_TRUE(ctx: _VSContext, instruction: dis.Instruction):
    """
    Jumps to the specified instruction if True-y is on the top of the stack.
    """

    i = ctx.pop()
    if not i:
        # Falsey, stay where we are.
        return ctx

    # Jump, again.
    ctx.instruction_pointer = get_instruction_index_by_offset(ctx, instruction)

    return ctx