← Back
Editing: normalize_ifelse.cpython-311.pyc
� cR�a� � �F � d Z ddlmZ ddlmZ ddlZ G d� de� � ZdS )z: NormalizeIfElse transform early exit in if into if-else. � )� Ancestors)�TransformationNc �. � � e Zd ZdZ� fd�Zd� Zd� Z� xZS )�NormalizeIfElsea� >>> import gast as ast >>> from pythran import passmanager, backend >>> node = ast.parse(""" ... def foo(y): ... if y: return 1 ... return 2""") >>> pm = passmanager.PassManager("test") >>> _, node = pm.apply(NormalizeIfElse, node) >>> print(pm.dump(backend.Python, node)) def foo(y): if y: return 1 else: return 2 >>> node = ast.parse(""" ... def foo(y): ... if y: ... z = y + 1 ... if z: ... return 1 ... else: ... return 3 ... return 2""") >>> pm = passmanager.PassManager("test") >>> _, node = pm.apply(NormalizeIfElse, node) >>> print(pm.dump(backend.Python, node)) def foo(y): if y: z = (y + 1) if z: return 1 else: return 3 else: return 2 c �b �� t t | � � � t � � d S )N)�superr �__init__r )�self� __class__s ��J/usr/lib/python3/dist-packages/pythran/transformations/normalize_ifelse.pyr zNormalizeIfElse.__init__2 s'