| Server IP : 217.160.0.135 / Your IP : 216.73.216.115 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/python3/dist-packages/pythran/optimizations/__pycache__/ |
Upload File : |
�
cR�a_ � �J � d Z ddlmZ ddlmZ ddlmZ G d� de� � ZdS )z* DeadCodeElimination remove useless code. � )�DefUseChains)�TransformationNc �( � � e Zd ZdZ� fd�Zd� Z� xZS )�RemoveDeadFunctionsa7
Remove useless local functions
>>> import gast as ast
>>> from pythran import passmanager, backend, metadata
>>> pm = passmanager.PassManager("test")
>>> node = ast.parse("def foo(): return 1")
>>> _, node = pm.apply(RemoveDeadFunctions, node)
>>> print(pm.dump(backend.Python, node))
def foo():
return 1
>>> node = ast.parse("def foo(): return 1")
>>> metadata.add(node.body[0], metadata.Local())
>>> _, node = pm.apply(RemoveDeadFunctions, node)
>>> print(pm.dump(backend.Python, node))
<BLANKLINE>
c �b �� t t | � � � t � � d S )N)�superr �__init__r )�self� __class__s ��M/usr/lib/python3/dist-packages/pythran/optimizations/remove_dead_functions.pyr zRemoveDeadFunctions.__init__ s( �� �
�!�4�(�(�1�1�,�?�?�?�?�?� c � � t j |t j � � r-| j j | � � � s d| _ d S |S )NT)�metadata�get�Local�def_use_chains�chains�users�update)r
�nodes r �visit_FunctionDefz%RemoveDeadFunctions.visit_FunctionDef sH � ��<��h�n�-�-� ��&�-�d�3�9�9�;�;�
�"����t��r
)�__name__�
__module__�__qualname__�__doc__r r �
__classcell__)r s @r r r sV �� � � � � �� �$@� @� @� @� @�� � � � � � r
r )r �pythran.analysesr �pythran.passmanagerr �pythran.metadatar r � r
r �<module>r! su �� 0� 0� )� )� )� )� )� )� .� .� .� .� .� .� #� #� #� #� #� #�� � � � �.� � � � � r