o
    tBh                     @  s   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
mZ ddlmZ G dd	 d	ZG d
d dZG dd deZdS )zGHelpers that store information about functions and the related classes.    )annotations)FuncItem)ClassIR)INVALID_FUNC_DEF)
BasicBlockValue)AssignmentTargetc                   @  s   e Zd ZdZedddddddfd,ddZd-ddZed.ddZed.ddZ	ed/ddZ
e
jd0ddZ
ed1d!d"Zejd2d$d"Zed3d&d'Zejd4d(d'Zed5d*d+ZdS )6FuncInfoz;Contains information about functions as they are generated. NFfitemr   namestr
class_name
str | None	namespace	is_nestedboolcontains_nestedis_decorated
in_non_extreturnNonec	           	      C  sL   || _ || _|| _|| _d | _d | _d | _d | _|| _|| _	|| _
|| _d S N)r   r   r   ns_callable_class
_env_class_generator_class_curr_env_regr   r   r   r   )	selfr   r   r   r   r   r   r   r    r   l/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/mypyc/irbuild/context.py__init__   s   
zFuncInfo.__init__c                 C  s    d dd | j| j| jfD S )N_c                 s  s    | ]}|r|V  qd S r   r   ).0xr   r   r    	<genexpr>6   s    z+FuncInfo.namespaced_name.<locals>.<genexpr>)joinr   r   r   r   r   r   r    namespaced_name5   s    zFuncInfo.namespaced_namec                 C  s   | j jp| j jS r   )r   is_generatoris_coroutiner'   r   r   r    r)   8   s   zFuncInfo.is_generatorc                 C  s   | j jS r   )r   r*   r'   r   r   r    r*   <   s   zFuncInfo.is_coroutineImplicitClassc                 C     | j d usJ | j S r   r   r'   r   r   r    callable_class@      zFuncInfo.callable_classclsc                 C  
   || _ d S r   r-   r   r0   r   r   r    r.   E      
r   c                 C  r,   r   r   r'   r   r   r    	env_classI   r/   zFuncInfo.env_classirc                 C  r1   r   r4   r   r6   r   r   r    r5   N   r3   GeneratorClassc                 C  r,   r   r   r'   r   r   r    generator_classR   r/   zFuncInfo.generator_classc                 C  r1   r   r9   r2   r   r   r    r:   W   r3   r   c                 C  r,   r   r   r'   r   r   r    curr_env_reg[   r/   zFuncInfo.curr_env_reg)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r   )r   r   )r   r+   )r0   r+   r   r   )r   r   r6   r   r   r   )r   r8   )r0   r8   r   r   r   r   )__name__
__module____qualname____doc__r   r!   r(   propertyr)   r*   r.   setterr5   r:   r<   r   r   r   r    r	      s<    
&r	   c                   @  st   e Zd ZdZdddZedd	d
Zejddd
ZedddZejdddZedddZ	e	jdddZ	dS )r+   a  Contains information regarding implicitly generated classes.

    Implicit classes are generated for nested functions and generator
    functions. They are not explicitly defined in the source code.

    NOTE: This is both a concrete class and used as a base class.
    r6   r   r   r   c                 C  s   || _ d | _d | _d | _d S r   )r6   	_self_regr   _prev_env_regr7   r   r   r    r!   j   s   
zImplicitClass.__init__r   c                 C  r,   r   rE   r'   r   r   r    self_regv   r/   zImplicitClass.self_regregc                 C  r1   r   rG   r   rI   r   r   r    rH   {   r3   c                 C  r,   r   r;   r'   r   r   r    r<      r/   zImplicitClass.curr_env_regc                 C  r1   r   r;   rJ   r   r   r    r<      r3   c                 C  r,   r   rF   r'   r   r   r    prev_env_reg   r/   zImplicitClass.prev_env_regc                 C  r1   r   rK   rJ   r   r   r    rL      r3   Nr=   r>   rI   r   r   r   )
r?   r@   rA   rB   r!   rC   rH   rD   r<   rL   r   r   r   r    r+   a   s    
r+   c                      s^   e Zd ZdZd fddZedd	d
Zejddd
ZedddZejdddZ  Z	S )r8   z?Contains information about implicit generator function classes.r6   r   r   r   c                   s6   t  | d | _d | _d | _d | _t | _g | _d S r   )	superr!   _next_label_reg_next_label_targetexc_regssend_arg_regr   switch_blockcontinuation_blocksr7   	__class__r   r    r!      s   
zGeneratorClass.__init__r   c                 C  r,   r   rO   r'   r   r   r    next_label_reg   r/   zGeneratorClass.next_label_regrI   c                 C  r1   r   rW   rJ   r   r   r    rX      r3   r   c                 C  r,   r   rP   r'   r   r   r    next_label_target   r/   z GeneratorClass.next_label_targettargetc                 C  r1   r   rY   )r   r[   r   r   r    rZ      r3   r=   r>   rM   )r   r   )r[   r   r   r   )
r?   r@   rA   rB   r!   rC   rX   rD   rZ   __classcell__r   r   rU   r    r8      s    r8   N)rB   
__future__r   
mypy.nodesr   mypyc.ir.class_irr   mypyc.ir.func_irr   mypyc.ir.opsr   r   mypyc.irbuild.targetsr   r	   r+   r8   r   r   r   r    <module>   s    U1