NL idZddlmZddlmZmZmZmZmZm Z m Z m Z m Z m Z mZmZddlmZddlmZmZddlmZddlmZ d dZ d d Zdd Zy )zIRBuilder 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 BytesExprComparisonExpr Expression FloatExprIntExpr MemberExprNameExprOpExprStrExpr UnaryExprVar) BasicBlock)is_fixed_width_rtype is_tagged) IRBuilder)constant_fold_exprcht|tr|jdvr|jdk(rLt}t ||j |||j |t ||j||yt}t ||j |||j |t ||j||yt|tr(|jdk(rt ||j||yt||||}|ry|j|}|j|||y)N)andorrnot) isinstancer oprprocess_conditionalleftactivate_blockrightrexpr$maybe_process_conditional_comparisonacceptadd_bool_branch)selfetruefalsenewresregs _/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/mypyc/irbuild/ast_helpers.pyrrs!V!6 445=,C affc5 9    $ aggtU ;,C affdC 8    $ aggtU ; Ay !addemD!&&%624D%H  kk!n S$.ct|trt|jdk7ry|j |jd}|j |jd}t |s t |rt |s t |sy|jd}|dvry|jd}|jd}t||} |j|| } |j|d} t |s t |rt |s|j| ||j} n(t |s|j| ||j} |j| | ||j} |jj|j| ||y|jj| | ||j} |j|j| ||y)akTransform 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>=) can_borrowT)rrlenoperands node_typerr operatorsis_borrow_friendly_exprr!coerceline binary_opbuilderflush_keep_alivesr") r#r$r%r&ltypertyper left_expr right_expr borrow_leftrrr)s r*r r 8s a (C Oq,@ NN1::a= )E NN1::a= )E 5 1%8 u !5e!< QB 33 1 IAJ)$ ;K ;;y[; 9D KK tK 4EE"&:5&A#E*;;tUAFF3D%e,KKuaff5EnnT5"aff5 &&( S$. ll$$T5"aff=   S$. r+c`t|ttttfryt|t t ttfr t||yt|tr.t|jtr|jtk(ryt|tr|j|ryy)zCan the result of the expression borrowed temporarily? Borrowing means keeping a reference without incrementing the reference count. TF)rr rr rrr r r rnoderkindris_native_attr_ref)r#rs r*r6r6gs $)Wi@A4)VXzBC tT * 6$! dii %$))t*;$ #(?(?(E r+N) r#rr$rr%rr&rreturnNone) r#rr$rr%rr&rrEbool)r#rrrrErG)__doc__ __future__r mypy.nodesrrrrrr r r r r rr mypyc.ir.opsrmypyc.ir.rtypesrrmypyc.irbuild.builderrmypyc.irbuild.constant_foldrrr r6r+r*rPs #    $;+:/ /"/*4/=G/ /6, ,",*4,=G, ,^r+