o
    @a                     @   s\   d Z ddlZddlmZ ddlmZ ddlmZ ddl	m
Z
mZ e
dZG dd	 d	eZdS )
za Immediates gathers immediates. For now, only integers within shape are
considered as immediates     N)MODULES)Aliases)NodeAnalysis)pythran_builtinisnumZ
make_shapec                       s$   e Zd Z fddZdd Z  ZS )
Immediatesc                    s   t  | _tt| t d S )N)setresultsuperr   __init__r   )self	__class__ =/usr/lib/python3/dist-packages/pythran/analyses/immediates.pyr      s   zImmediates.__init__c                 C   s   | j |j }|D ]#}t|dg r+t|jD ]\}}||jv r*t|tjr*| j	
| qqt|dkrHtt|tu rH| j	dd |jD  d S | |S )Nimmediate_arguments   c                 s   s2    | ]}t |rt|jtr|jd kr|V  qdS )r   N)r   
isinstancevalueint).0ar   r   r   	<genexpr>   s    
z(Immediates.visit_Call.<locals>.<genexpr>)aliasesfuncgetattr	enumerateargsr   r   astZConstantr	   addlennextiter_make_shapeupdateZgeneric_visit)r   ZnodeZfunc_aliasesaliasiargr   r   r   
visit_Call   s   

zImmediates.visit_Call)__name__
__module____qualname__r   r(   __classcell__r   r   r   r   r      s    r   )__doc__Zgastr   Zpythran.tablesr   Zpythran.analysesr   Zpythran.passmanagerr   Zpythran.utilsr   r   r#   r   r   r   r   r   <module>   s    