Files
intellecton/venv/lib/python3.12/site-packages/jinja2/__pycache__/optimizer.cpython-312.pyc
T

20 lines
2.6 KiB
Plaintext
Raw Normal View History

Ë
jsãóždZddlZddlmZddlmZejrddlm Z dejdd d
ejfd Z Gd d
e«Z y)The optimizer tries to constant fold expressions and modify the AST
in place so that it should be faster to evaluate.
Because the AST does not contain all the scoping information and the
compiler has to find that out, we cannot do all the optimizations we
want. For example, loop unrolling doesn't work because unrolled loops
would have a different scope. The solution would be a second syntax tree
that stored the scoping rules.
é)Únodes)ÚNodeTransformer)Ú EnvironmentÚnodeÚ environmentrÚreturncó~t|«}tjtj|j |««S)z^The context hint can be used to perform an static optimization
based on the context given.)Ú OptimizerÚcastrÚNodeÚvisit)rrÚ optimizers úS/home/antigravity/intellecton/venv/lib/python3.12/site-packages/jinja2/optimizer.pyÚoptimizers,ô˜&€IÜ 6‰6”%—**˜iŸo™o¨dÓ cóˆeZdZddZdej
dejdejdej
fˆfd ZˆxZ S)r r có||_y)N)r)Úselfrs rÚ__init__zOptimizer.__init__s
Ø&ˆÕrrÚargsÚkwargscó0t||g|¢­i|¤Ž}t|tj«rM tj
j
|j|r|dnd«|j|j¬«S|S#tj$rY|SwxYw)Nr)Úlinenor) ÚsuperÚ
generic_visitÚ
isinstancerÚExprÚConstÚfrom_untrustedÚas_constrrÚ