o
    8ήcz                     @   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 )    )errorsir)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 | _|| _|jddD ]#}z|j| jv r'|jtju r'||j	| j|< W q t
jy2   Y qw t| j dkp@t| jdkS )Nbinop)opr   )
static_lhs
static_rhsblock
find_exprsfnrhs_operatorsr   	UNDEFINEDinfer_constantrhsr   ConstantInferenceErrorlen)selffunc_irr   typemap	calltypesexpr r   G/tmp/pip-target-vg8gfxp4/lib/python/numba/core/rewrites/static_binop.pymatch   s   
zDetectStaticBinops.matchc                 C   s    | j  D ]\}}||_ q| 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)
numba.corer   r   numba.core.rewritesr   r   r   r   r   r   r   <module>   s    