← Back
Editing: locals_analysis.cpython-311.pyc
� cR�ag � �F � d Z ddlmZ ddlmZ ddlZ G d� de� � ZdS )z' Locals computes the value of locals() � )�ModuleAnalysisNc � � � e Zd ZdZ� fd�Z� fd�Zd� Zd� Zd� Zd� Z d� Z d � Zd � Zd� Z eZeZeZeZeZeZeZeZeZeZeZeZeZ� xZS )�Localsa� Statically compute the value of locals() before each statement Yields a dictionary binding every node to the set of variable names defined *before* this node. Following snippet illustrates its behavior: >>> import gast as ast >>> from pythran import passmanager >>> pm = passmanager.PassManager('test') >>> code = ''' ... def b(n): ... m = n + 1 ... def b(n): ... return n + 1 ... return b(m)''' >>> tree = ast.parse(code) >>> l = pm.gather(Locals, tree) >>> sorted(l[tree.body[0].body[0]]) ['n'] >>> sorted(l[tree.body[0].body[1]]) ['b', 'm', 'n'] c � �� t � � | _ t � � | _ d| _ t t | � � � � � d S )Nr )�dict�result�set�locals�nesting�superr �__init__)�self� __class__s ��B/usr/lib/python3/dist-packages/pythran/analyses/locals_analysis.pyr zLocals.__init__$ sB �� ��f�f����e�e������ �f�d���$�$�&�&�&�&�&� c � �� t t | � � � |� � || j vr| j | j | j |<