
    X-Pha                        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	          Z G d
 d          Z G 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            	      ,   e Zd ZdZeddddddddf	d%dZd&dZed'd            Zed'd            Z	ed(d            Z
e
j        d)d            Z
ed*d            Zej        d+d            Zed,d!            Zej        d-d"            Zed.d$            ZdS )/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add_nested_funcs_to_envreturnNonec
                    || _         || _        || _        || _        d | _        d | _        d | _        d | _        || _        || _	        || _
        || _        |	| _        d S N)r   r   r   ns_callable_class
_env_class_generator_class_curr_env_regr   r   r   r   r   )
selfr   r   r   r   r   r   r   r   r   s
             U/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mypyc/irbuild/context.py__init__zFuncInfo.__init__   su     
	$ 6: +/ 8< ,0 #.($'>$$$    c                d    d                     d | j        | j        | j        fD                       S )N_c              3     K   | ]}||V  	d S r    ).0xs     r#   	<genexpr>z+FuncInfo.namespaced_name.<locals>.<genexpr>8   s'      NNaANNNNNNNr%   )joinr   r   r   r"   s    r#   namespaced_namezFuncInfo.namespaced_name7   s0    xxNNDIt#HNNNNNNr%   c                2    | j         j        p| j         j        S r   )r   is_generatoris_coroutiner.   s    r#   r1   zFuncInfo.is_generator:   s    z&A$**AAr%   c                    | j         j        S r   )r   r2   r.   s    r#   r2   zFuncInfo.is_coroutine>   s    z&&r%   ImplicitClassc                "    | j         J | j         S r   r   r.   s    r#   callable_classzFuncInfo.callable_classB       #///##r%   clsc                    || _         d S r   r6   r"   r9   s     r#   r7   zFuncInfo.callable_classG       "r%   r   c                "    | j         J | j         S r   r   r.   s    r#   	env_classzFuncInfo.env_classK   s    ***r%   irc                    || _         d S r   r>   r"   r@   s     r#   r?   zFuncInfo.env_classP   s    r%   GeneratorClassc                "    | j         J | j         S r   r    r.   s    r#   generator_classzFuncInfo.generator_classT   s    $000$$r%   c                    || _         d S r   rE   r;   s     r#   rF   zFuncInfo.generator_classY   s     #r%   r   c                "    | j         J | j         S r   r!   r.   s    r#   curr_env_regz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   r   )r   r4   )r9   r4   r   r   )r   r   r@   r   r   r   )r   rC   )r9   rC   r   r   r   r   )__name__
__module____qualname____doc__r   r$   r/   propertyr1   r2   r7   setterr?   rF   rJ   r)   r%   r#   r   r      s       EE +!% %" (-$? $? $? $? $?PO O O O B B B XB ' ' ' X' $ $ $ X$ # # # #    X     % % % X% $ $ $ $ " " " X" " "r%   r   c                      e Zd ZdZddZedd            Zej        dd
            Zedd            Zej        dd            Zedd            Z	e	j        dd            Z	dS )r4   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.
    r@   r   r   r   c                >    || _         d | _        d | _        d | _        d S r   )r@   	_self_regr!   _prev_env_regrB   s     r#   r$   zImplicitClass.__init__l   s(    '+
 ,0+/r%   r   c                "    | j         J | j         S r   rV   r.   s    r#   self_regzImplicitClass.self_regx   s    ~)))~r%   regc                    || _         d S r   rY   r"   r[   s     r#   rZ   zImplicitClass.self_reg}   s    r%   c                "    | j         J | j         S r   rI   r.   s    r#   rJ   zImplicitClass.curr_env_reg   rK   r%   c                    || _         d S r   rI   r]   s     r#   rJ   zImplicitClass.curr_env_reg        r%   c                "    | j         J | j         S r   rW   r.   s    r#   prev_env_regzImplicitClass.prev_env_reg   rK   r%   c                    || _         d S r   rb   r]   s     r#   rc   zImplicitClass.prev_env_reg   r`   r%   NrL   rM   r[   r   r   r   )
rN   rO   rP   rQ   r$   rR   rZ   rS   rJ   rc   r)   r%   r#   r4   r4   c   s         
0 
0 
0 
0    X _   _ " " " X" ! ! ! ! " " " X" ! ! ! ! ! !r%   r4   c                       e Zd ZdZd fdZedd            Zej        dd
            Zedd            Zej        dd            Z xZ	S )rC   z?Contains information about implicit generator function classes.r@   r   r   r   c                    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_blocks)r"   r@   	__class__s     r#   r$   zGeneratorClass.__init__   s]     .2;? <@ +/ 'LL57   r%   r   c                "    | j         J | j         S r   ri   r.   s    r#   next_label_regzGeneratorClass.next_label_reg   r8   r%   r[   c                    || _         d S r   rq   r]   s     r#   rr   zGeneratorClass.next_label_reg   r<   r%   r	   c                "    | j         J | j         S r   rj   r.   s    r#   next_label_targetz GeneratorClass.next_label_target   s    &222&&r%   targetc                    || _         d S r   ru   )r"   rw   s     r#   rv   z GeneratorClass.next_label_target   s    "(r%   rL   rM   re   )r   r	   )rw   r	   r   r   )
rN   rO   rP   rQ   r$   rR   rr   rS   rv   __classcell__)ro   s   @r#   rC   rC      s        II8 8 8 8 8 8& $ $ $ X$ # # # # ' ' ' X' ) ) ) ) ) ) ) )r%   rC   N)rQ   
__future__r   
mypy.nodesr   mypyc.ir.class_irr   mypyc.ir.func_irr   mypyc.ir.opsr   r   mypyc.irbuild.targetsr	   r   r4   rC   r)   r%   r#   <module>r      s   M M " " " " " "       % % % % % % - - - - - - * * * * * * * * 2 2 2 2 2 2T" T" T" T" T" T" T" T"n.! .! .! .! .! .! .! .!b&) &) &) &) &)] &) &) &) &) &)r%   