U
    {h,                     @   s,   d dl mZ d dlmZ G dd deZdS )   )VisitorTransform)StatListNodec                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	ExtractPxdCodea  
    Finds nodes in a pxd file that should generate code, and
    returns them in a StatListNode.

    The result is a tuple (StatListNode, ModuleScope), i.e.
    everything that is needed from the pxd after it is processed.

    A purer approach would be to separately compile the pxd code,
    but the result would have to be slightly more sophisticated
    than pure strings (functions + wanted interned strings +
    wanted utility code + wanted cached objects) so for now this
    approach is taken.
    c                 C   s&   g | _ | | t|j| j d|jfS )N)stats)funcsvisitchildrenr   posZscope)selfroot r   B/tmp/pip-unpacked-wheel-fhl22ezh/Cython/Compiler/CodeGeneration.py__call__   s    
zExtractPxdCode.__call__c                 C   s   | j | |S N)r   appendr	   noder   r   r   visit_FuncDefNode   s    z ExtractPxdCode.visit_FuncDefNodec                 C   s   |  | |S r   )r   r   r   r   r   
visit_Node   s    
zExtractPxdCode.visit_NodeN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r      s   r   N)ZVisitorr   ZNodesr   r   r   r   r   r   <module>   s   