Ë
    pPêj  ã                  óÂ  — d Z ddlmZ ddlmZ ddlmZmZmZ ddl	m
Z
 ddlmZmZmZm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 ddlmZmZmZ ddlmZm 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+m,Z,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5  ededef   ¬«      Z6 eee6ge6f    ejn                  d«      «      Z8e8	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Z9dd„Z:y) a?  Transform a mypy AST to the IR form (Intermediate Representation).

For example, consider a function like this:

   def f(x: int) -> int:
       return x * 2 + 1

It would be translated to something that conceptually looks like this:

   r0 = 2
   r1 = 1
   r2 = x * r0 :: int
   r3 = r2 + r1 :: int
   return r3

This module deals with the module-level IR transformation logic and
putting it all together. The actual IR is implemented in mypyc.ir.

For the core of the IR transform implementation, look at build_ir()
below, mypyc.irbuild.builder, and mypyc.irbuild.visitor.
é    )Úannotations)ÚCallable)ÚAnyÚTypeVarÚcast)ÚGraph)ÚClassDefÚ
ExpressionÚFuncDefÚMypyFile)Ústate)ÚType)Úanalyze_always_defined_attrs)ÚTOP_LEVEL_NAME)ÚErrors)ÚFuncDeclÚFuncIRÚFuncSignature)ÚModuleIRÚ	ModuleIRs)Únone_rprimitive)Ú	IRBuilder)ÚMapper)ÚPreBuildVisitor)Ú#adjust_generator_classes_of_methodsÚbuild_type_mapÚcreate_generator_class_for_funcÚ"find_singledispatch_register_impls)ÚIRBuilderVisitor)Úcompute_vtable)ÚCompilerOptions)Úpromote_generator_registersÚF.)ÚboundTc                óØ  — t        || ||||«       t        |«       t        | |«      }i }|j                  dkD  r|S g }| D �]S  }	t	        ||	|j
                  |«      }
|	j                  |
«       |
j                  D ]U  }t        |t        «      sŒd|j                  › �}|j                  s|j                  sŒ<t        |	j                  d|||¬«       ŒW t        «       }t!        |	j                  |||||
|||j"                  «	      }||_        t'        ||	«       t)        |	j                  t+        |j,                  «      |j.                  |j0                  |j2                  |j4                  «      }|||	j                  <   |j7                  |j0                  «       �ŒV |D ]%  }|j8                  €Œt;        |j8                  |«       Œ' t=        |«       |D ]  }|j>                  sŒtA        |«       Œ |S )zËBuild basic IR for a set of modules that have been type-checked by mypy.

    The returned IR is not complete and requires additional
    transformations, such as the insertion of refcount handling.
    r   Ú___N)Úname_suffix)!r   r   r   Ú
num_errorsr   Údecorators_to_removeÚacceptÚnested_funcsÚ
isinstancer   ÚlineÚis_coroutineÚis_generatorr   Úfullnamer   r   Úsingledispatch_implsÚbuilderÚtransform_mypy_filer   ÚlistÚimportsÚ	functionsÚclassesÚfinal_namesÚtype_var_namesÚextendÚenv_user_functionr"   r   Úis_ext_classr    )ÚmodulesÚgraphÚtypesÚmapperÚoptionsÚerrorsÚsingledispatch_infoÚresultÚ	class_irsÚmoduleÚpbvÚfdefÚsuffixÚvisitorr2   Ú	module_irÚclass_irÚcirs                     úW/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/mypyc/irbuild/main.pyÚbuild_irrO   :   sé  € ô �6˜7 E¨5°'¸6ÔBÜ'¨Ô/Ü<¸WÀfÓMÐà€FØ×Ñ˜1ÒØˆð €Iàó )*ˆä˜f fÐ.A×.VÑ.VÐX]Ó^ˆØ�‰�cÔð ×$Ñ$ò 	ˆDÜ˜$¤Õ(à˜tŸy™y˜kÐ*�Ø×$Ò$¨×(9Ó(9Ü3ØŸ™¨¨t°VÈöð	ô #Ó$ˆÜØ�O‰OØØØØØØØØ×4Ñ4ó

ˆð "ˆŒô 	˜G VÔ,ÜØ�O‰OÜ�—‘Ó!Ø×ÑØ�O‰OØ×ÑØ×"Ñ"ó
ˆ	ð #,ˆˆv�‰ÑØ×Ñ˜Ÿ™Ö)ðS)*ð\ ò NˆØ×%Ñ%Ñ1Ü'¨×(BÑ(BÀHÕMðNô ! Ô+ð ò  ˆØ×ÓÜ˜3Õð ð €Mó    c                óÔ  — |j                   dv ry| j                  |j                   |j                  «       |j                  D �cg c]  }t	        |t
        «      sŒ|‘Œ }}|D ]@  }| j                  j                  |j                     }| j                  j                  |«       ŒB | j                  d«       | j                  dd«       |j                  D ]  }| j                  |«       Œ | j                  «        | j                  «       \  }}}}	}t!        g t"        «      }
t%        t'        t(        d| j*                  |
«      ||d¬«      }| j,                  j                  |«       yc c}w )z Generate IR for a single module.)ÚtypingÚabcNz<module>Úbuiltinsé   )Útraceback_name)r0   Ú
set_moduleÚpathÚdefsr,   r	   r@   Ú
type_to_irÚinfor7   ÚappendÚenterÚ
gen_importr*   Úmaybe_add_implicit_returnÚleaver   r   r   r   r   Úmodule_namer6   )r2   ÚmypyfileÚnoder7   ÚclsÚirÚargsÚ_ÚblocksÚret_typeÚsigÚfunc_irs               rN   r3   r3   �   sC  € ð ×ÑÐ-Ñ-ð 	à×Ñ�x×(Ñ(¨(¯-©-Ô8à (§¡ÖL˜´¸DÄ(Õ1KŠtÐL€GÐLð ò #ˆØ�^‰^×&Ñ& s§x¡xÑ0ˆØ�‰×Ñ˜rÕ"ð#ð ‡M�M�*Ôð ×Ñ�z 1Ô%ð —‘ò ˆØ�‰�tÕðð ×%Ñ%Ô'ð $+§=¡=£?Ñ €Dˆ!ˆV�X˜qÜ
˜œOÓ
,€CÜÜ”  w×':Ñ':¸CÓ@ØØØ!ô	€Gð ×Ñ×Ñ˜WÕ%ùò7 Ms   ÁE%ÁE%N)r=   zlist[MypyFile]r>   r   r?   zdict[Expression, Type]r@   r   rA   r!   rB   r   Úreturnr   )r2   r   rb   r   rl   ÚNone);Ú__doc__Ú
__future__r   Úcollections.abcr   rR   r   r   r   Ú
mypy.buildr   Ú
mypy.nodesr	   r
   r   r   Ú
mypy.stater   Ú
mypy.typesr   Úmypyc.analysis.attrdefinedr   Úmypyc.commonr   Úmypyc.errorsr   Úmypyc.ir.func_irr   r   r   Úmypyc.ir.module_irr   r   Úmypyc.ir.rtypesr   Úmypyc.irbuild.builderr   Úmypyc.irbuild.mapperr   Úmypyc.irbuild.prebuildvisitorr   Úmypyc.irbuild.preparer   r   r   r   Úmypyc.irbuild.visitorr   Úmypyc.irbuild.vtabler    Úmypyc.optionsr!   Ú mypyc.transform.generator_spillsr"   r#   Ústrict_optional_setÚstrict_optional_decrO   r3   © rP   rN   ú<module>r†      sÿ   ðñõ, #å $ß %Ñ %å ß >Ó >Ý Ý Ý CÝ 'Ý ß <Ñ <ß 2Ý +Ý +Ý 'Ý 9÷ó õ 3Ý /Ý )Ý Hñ ˆC�x  S Ñ)Ô*€Ù˜8 Q C¨ FÑ+Ð-F¨U×-FÑ-FÀtÓ-LÓMÐ ð ðRØðRàðRð "ðRð ð	Rð
 ðRð ðRð òRó ðRôj%&rP   