Ë
    pPêjó  ã                  óÀ   — d Z ddlmZ ddlmZmZmZmZmZm	Z	m
Z
mZmZmZmZmZ ddlmZ ddlmZmZ ddlmZ ddlmZ 	 	 	 	 	 	 	 	 	 	 dd„Z	 	 	 	 	 	 	 	 	 	 dd	„Zdd
„Zy)z½IRBuilder AST transform helpers shared between expressions and statements.

Shared code that is tightly coupled to mypy ASTs can be put here instead of
making mypyc.irbuild.builder larger.
é    )Úannotations)ÚLDEFÚ	BytesExprÚComparisonExprÚ
ExpressionÚ	FloatExprÚIntExprÚ
MemberExprÚNameExprÚOpExprÚStrExprÚ	UnaryExprÚVar)Ú
BasicBlock)Úis_fixed_width_rtypeÚ	is_tagged)Ú	IRBuilder)Úconstant_fold_exprc                óh  — t        |t        «      rµ|j                  dv r§|j                  dk(  rLt        «       }t	        | |j
                  ||«       | j                  |«       t	        | |j                  ||«       y t        «       }t	        | |j
                  ||«       | j                  |«       t	        | |j                  ||«       y t        |t        «      r(|j                  dk(  rt	        | |j                  ||«       y t        | |||«      }|ry | j                  |«      }| j                  |||«       y )N)ÚandÚorr   Únot)Ú
isinstancer   Úopr   Úprocess_conditionalÚleftÚactivate_blockÚrightr   ÚexprÚ$maybe_process_conditional_comparisonÚacceptÚadd_bool_branch)ÚselfÚeÚtrueÚfalseÚnewÚresÚregs          ú^/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/mypyc/irbuild/ast_helpers.pyr   r      só   € ô �!”VÔ §¡¨Ñ!6Ø�4‰4�5Š=ä“,ˆCÜ  a§f¡f¨c°5Ô9Ø×Ñ Ô$Ü  a§g¡g¨t°UÕ;ô “,ˆCÜ  a§f¡f¨d°CÔ8Ø×Ñ Ô$Ü  a§g¡g¨t°UÕ;Ü	�A”yÔ	! a§d¡d¨e¢mÜ˜D !§&¡&¨%°Õ6ä2°4¸¸DÀ%ÓHˆÙØà�k‰k˜!‹nˆØ×Ñ˜S $¨Õ.ó    c                ó  — t        |t        «      rt        |j                  «      dk7  ry| j	                  |j                  d   «      }| j	                  |j                  d   «      }t        |«      st        |«      rt        |«      st        |«      sy|j                  d   }|dvry|j                  d   }|j                  d   }t        | |«      }	| j                  ||	¬«      }
| j                  |d¬«      }t        |«      st        |«      r¨t        |«      s| j                  |
||j                  «      }
n(t        |«      s| j                  |||j                  «      }| j                  |
|||j                  «      }| j                  j                  |j                  «       | j                  |||«       y| j                  j                  |
|||j                  «      }| j                  |j                  «       | j                  |||«       y)ak  Transform simple tagged integer comparisons in a conditional context.

    Return True if the operation is supported (and was transformed). Otherwise,
    do nothing and return False.

    Args:
        self: IR form Builder
        e: Arbitrary expression
        true: Branch target if comparison is true
        false: Branch target if comparison is false
    é   Fr   é   )z==z!=ú<z<=ú>z>=)Ú
can_borrowT)r   r   ÚlenÚoperandsÚ	node_typer   r   Ú	operatorsÚis_borrow_friendly_exprr!   ÚcoerceÚlineÚ	binary_opÚbuilderÚflush_keep_alivesr"   )r#   r$   r%   r&   ÚltypeÚrtyper   Ú	left_exprÚ
right_exprÚborrow_leftr   r   r)   s                r*   r    r    8   sª  € ô �aœÔ(¬C°·
±
«O¸qÒ,@ØØ�N‰N˜1Ÿ:™: a™=Ó)€EØ�N‰N˜1Ÿ:™: a™=Ó)€Eä	�5Ô	Ô1°%Ô8Ü�uÔÔ!5°eÔ!<àØ	
�‰�Q‰€BØ	Ð3Ñ3ØØ—
‘
˜1‘€IØ—‘˜A‘€JÜ)¨$°
Ó;€KØ�;‰;�y¨[ˆ;Ó9€DØ�K‰K˜
¨tˆKÓ4€EÜ˜EÔ"Ô&:¸5Ô&AÜ# EÔ*Ø—;‘;˜t U¨A¯F©FÓ3‰DÜ% eÔ,Ø—K‘K  u¨a¯f©fÓ5ˆEØ�n‰n˜T 5¨"¨a¯f©fÓ5ˆØ�‰×&Ñ& q§v¡vÔ.Ø×Ñ˜S $¨Ô.ð ð �l‰l×$Ñ$ T¨5°"°a·f±fÓ=ˆØ×Ñ˜qŸv™vÔ&Ø×Ñ˜S $¨Ô.Ør+   c                ó`  — t        |t        t        t        t        f«      ryt        |t
        t        t        t        f«      rt        | |«      �yt        |t        «      r.t        |j                  t        «      r|j                  t        k(  ryt        |t        «      r| j                  |«      ryy)zŽCan the result of the expression borrowed temporarily?

    Borrowing means keeping a reference without incrementing the reference count.
    TF)r   r	   r   r   r   r   r   r   r
   r   Únoder   Úkindr   Úis_native_attr_ref)r#   r   s     r*   r6   r6   g   s‚   € ô
 �$œ¤)¬W´iÐ@ÔAàä�4œ)¤V¬X´zÐBÔCÜ˜t TÓ*Ð6ð Ü�$œÔ!Ü�d—i‘i¤Ô%¨$¯)©)´tÒ*;àÜ�$œ
Ô#¨×(?Ñ(?ÀÔ(EØØr+   N)
r#   r   r$   r   r%   r   r&   r   ÚreturnÚNone)
r#   r   r$   r   r%   r   r&   r   rE   Úbool)r#   r   r   r   rE   rG   )Ú__doc__Ú
__future__r   Ú
mypy.nodesr   r   r   r   r   r	   r
   r   r   r   r   r   Úmypyc.ir.opsr   Úmypyc.ir.rtypesr   r   Úmypyc.irbuild.builderr   Úmypyc.irbuild.constant_foldr   r   r    r6   © r+   r*   ú<module>rP      s‘   ðñõ #÷÷ ÷ ó õ $ß ;Ý +Ý :ð/Ø
ð/Ø"ð/Ø*4ð/Ø=Gð/à	ó/ð6,Ø
ð,Ø"ð,Ø*4ð,Ø=Gð,à	ó,ô^r+   