B
     \c                 @   s<   d dl mZmZ ddlmZmZ edG dd deZdS )    )irerrors   )register_rewriteRewritezbefore-inferencec               @   s&   e Zd ZdZdhZdd Zdd ZdS )DetectStaticBinopsz5
    Detect constant arguments to select binops.
    z**c          	   C   s   i | _ i | _|| _x\|jddD ]L}y.|j| jkrP|jtjkrP||j	| j|< W q  t
jk
rj   w Y q X q W t| j dkpt| jdkS )NZbinop)opr   )Z
static_lhs
static_rhsblockZ
find_exprsfnrhs_operatorsr   Z	UNDEFINEDZinfer_constantrhsr   ZConstantInferenceErrorlen)selfZfunc_irr
   ZtypemapZ	calltypesexpr r   :lib/python3.7/site-packages/numba/rewrites/static_binop.pymatch   s    zDetectStaticBinops.matchc             C   s$   x| j  D ]\}}||_ qW | jS )zI
        Store constant arguments that were detected in match().
        )r	   itemsr
   )r   r   r   r   r   r   apply   s    
zDetectStaticBinops.applyN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r      s   r   N)Znumbar   r    r   r   r   r   r   r   r   <module>   s   