Sindbad~EG File Manager
�
SԚg�j � �� � d dl Z d dlmZmZ d dlZd dlZd dlmZ d dlm Z d� Z
d� Z G d� de � � Z G d � d
ej
� � Zedk r ej � � dS dS )� N)�combinations�product)�support)�BytecodeTestCasec �p � t j d| � d�� � }i }t ||� � |d j S )Nz=
def f(x):
match x:
case z#:
pass
�f)�textwrap�dedent�exec�__code__)�pattern�source� namespaces �0/usr/local/lib/python3.11/test/test_peepholer.py� compile_pattern_with_fast_localsr
sP � �
�_� � � � � �� �F� �I��������S�>�"�"� c �� � d}t j | � � D ]}|j |k r|dz
}�t | d� � r| j } | j D ]%}t |d� � r|t
||� � z
}�&|S )Nr � r �co_code)�dis�get_instructions�opname�hasattrr � co_consts�count_instr_recursively)r r �count�instr�cs r r r s� � �
�E��%�a�(�(� � ���<�6�!�!��Q�J�E���q�*��� �
�J��
�[� 8� 8���1�i� � � 8��,�Q��7�7�7�E���Lr c �8 � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z
d � Zd
� Zd� Z
d� Zd
� Zd� Z ej d� � d� � � Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z e j! d� � d� � � Z"d� Z#d � Z$d!� Z%d"� Z&d#� Z'd$� Z(d%� Z)d&S )'�
TestTranformsc
�. � t t j |� � � � }d� |D � � }|D ]�}d|j vr�||j }|j dv r4| � |j � d|j � d|j � d|j � �� � |j dv r?|j dk r4| � |j � d|j � d|j � d|j � �� � d|j v r=d|j v r4| � |j � d|j � d|j � d|j � �� � ��d S ) Nc � � i | ]
}|j |��S � )�offset��.0r s r �
<dictcomp>z4TestTranforms.check_jump_targets.<locals>.<dictcomp>) s � �A�A�A�5�5�<��A�A�Ar �JUMP_)�
JUMP_ABSOLUTE�JUMP_FORWARDz at z
jumps to �RETURN_VALUE�_OR_POP�JUMP_IF_)�listr r r �argval�failr$ )�self�code�instructions�targetsr �tgts r �check_jump_targetsz TestTranforms.check_jump_targets'