Hacked By AnonymousFox
�
�܋fr � � � d Z ddlZddlmZ ddlmZ ej rddlm Z dej
dd d
ej
fd�Z G d� d
e� � ZdS )a� The optimizer tries to constant fold expressions and modify the AST
in place so that it should be faster to evaluate.
Because the AST does not contain all the scoping information and the
compiler has to find that out, we cannot do all the optimizations we
want. For example, loop unrolling doesn't work because unrolled loops
would have a different scope. The solution would be a second syntax tree
that stored the scoping rules.
� N� )�nodes)�NodeTransformer)�Environment�node�environmentr �returnc � � t |� � }t j t j |� | � � � � S )z^The context hint can be used to perform an static optimization
based on the context given.)� Optimizer�t�castr �Node�visit)r r � optimizers �G/opt/cloudlinux/venv/lib64/python3.11/site-packages/jinja2/optimizer.py�optimizer s1 � � �+�&�&�I��6�%�*�i�o�o�d�3�3�4�4�4� c �` � � e Zd Zd
d�Zdej dej dej dej f� fd �Z� xZ S )r r �t.Optional[Environment]r Nc � � || _ d S )N)r )�selfr s r �__init__zOptimizer.__init__ s � �&����r r �args�kwargsc �4 �� t � � j |g|�R i |��}t |t j � � r_ t j � |� |r|d nd � � |j | j �� � S # t j
$ r Y nw xY w|S )Nr )�linenor )�super�
generic_visit�
isinstancer �Expr�Const�from_untrusted�as_constr r �
Impossible)r r r r � __class__s �r r zOptimizer.generic_visit s� �� � %�u�w�w�$�T�;�D�;�;�;�F�;�;�� �d�E�J�'�'� �
��{�1�1��M�M�T�";�$�q�'�'�t�<�<��;� $� 0� 2� � � ��
�#�
�
�
���
���� �s �AB �B�B)r r r N)
�__name__�
__module__�__qualname__r r r r �Anyr �
__classcell__)r% s @r r r sy �� � � � � �'� '� '� '���J��'(�u��89��� ��� � � � � � � � � r r )
�__doc__�typingr � r �visitorr �
TYPE_CHECKINGr r r r r � r r �<module>r1 s� ��� � � � � � � � � � � � $� $� $� $� $� $��?� )�(�(�(�(�(�(�5�5�:� 5�M� 5�e�j� 5� 5� 5� 5�� � � � �� � � � � r
Hacked By AnonymousFox1.0, Coded By AnonymousFox