
    e~                        d dl mZ ddlmZ d dlZej                  rddlmZ  G d de      Z	 G d	 d
e      Z
 G d de      Zy)    )annotations   )
AstVisitorN   )mparserc                  T    e Zd ZddZddZddZddZddZddZddZ	ddZ
dd	Zy
)AstIndentationGeneratorc                    d| _         y Nr   levelselfs    </usr/lib/python3/dist-packages/mesonbuild/ast/postprocess.py__init__z AstIndentationGenerator.__init__   s	    
    c                &    | j                   |_         y Nr   r   nodes     r   visit_default_funcz*AstIndentationGenerator.visit_default_func   s    ZZ
r   c                    | j                  |       | xj                  dz  c_        |j                  j                  |        | xj                  dz  c_        y Nr   r   r   argsacceptr   s     r   visit_ArrayNodez'AstIndentationGenerator.visit_ArrayNode!   <    %

a
		

a
r   c                    | j                  |       | xj                  dz  c_        |j                  j                  |        | xj                  dz  c_        y r   r   r   s     r   visit_DictNodez&AstIndentationGenerator.visit_DictNode'   r   r   c                    | j                  |       |j                  j                  |        | xj                  dz  c_        |j                  j                  |        | xj                  dz  c_        y r   )r   source_objectr   r   r   r   s     r   visit_MethodNodez(AstIndentationGenerator.visit_MethodNode-   sP    %!!$'

a
		

a
r   c                    | j                  |       | xj                  dz  c_        |j                  j                  |        | xj                  dz  c_        y r   r   r   s     r   visit_FunctionNodez*AstIndentationGenerator.visit_FunctionNode4   r   r   c                    | j                  |       | xj                  dz  c_        |j                  j                  |        |j                  j                  |        | xj                  dz  c_        y r   )r   r   itemsr   blockr   s     r   visit_ForeachClauseNodez/AstIndentationGenerator.visit_ForeachClauseNode:   sN    %

a


$

$

a
r   c                   | j                  |       |j                  D ]  }|j                  |         |j                  rF| xj                  dz  c_        |j                  j                  |        | xj                  dz  c_        y y r   )r   ifsr   	elseblockr   r   r   is      r   visit_IfClauseNodez*AstIndentationGenerator.visit_IfClauseNodeA   sf    % 	AHHTN	>>JJ!OJNN!!$'JJ!OJ r   c                    | j                  |       | xj                  dz  c_        |j                  j                  |        |j                  j                  |        | xj                  dz  c_        y r   )r   r   	conditionr   r(   r   s     r   visit_IfNodez$AstIndentationGenerator.visit_IfNodeJ   sN    %

a
d#

$

a
r   NreturnNoner   zmparser.BaseNoder4   r5   )r   zmparser.ArrayNoder4   r5   )r   zmparser.DictNoder4   r5   )r   zmparser.MethodNoder4   r5   )r   zmparser.FunctionNoder4   r5   r   zmparser.ForeachClauseNoder4   r5   r   zmparser.IfClauseNoder4   r5   r   zmparser.IfNoder4   r5   )__name__
__module____qualname__r   r   r   r    r#   r%   r)   r/   r2    r   r   r	   r	      s/     r   r	   c                      e Zd ZddZddZy)AstIDGeneratorc                    i | _         y r   )counterr   s    r   r   zAstIDGenerator.__init__R   s	    )+r   c                    t        |      j                  }|| j                  vrd| j                  |<   |dz   t        | j                  |         z   |_        | j                  |xx   dz  cc<   y )Nr   #r   )typer:   rA   strast_id)r   r   names      r   r   z!AstIDGenerator.visit_default_funcU   s]    Dz""t||#!"DLLSj3t||D'9#::Tar   Nr3   r6   )r:   r;   r<   r   r   r=   r   r   r?   r?   Q   s    , r   r?   c                  4    e Zd ZddZddZd	dZd
dZddZy)AstConditionLevelc                    d| _         y r   condition_levelr   s    r   r   zAstConditionLevel.__init__]   s
     r   c                &    | j                   |_         y r   rK   r   s     r   r   z$AstConditionLevel.visit_default_func`   s    #33r   c                    | j                  |       | xj                  dz  c_        |j                  j                  |        |j                  j                  |        | xj                  dz  c_        y r   )r   rL   r'   r   r(   r   s     r   r)   z)AstConditionLevel.visit_ForeachClauseNodec   sV    %!

$

$!r   c                   | j                  |       |j                  D ]  }|j                  |         |j                  rF| xj                  dz  c_        |j                  j                  |        | xj                  dz  c_        y y r   )r   r+   r   r,   rL   r-   s      r   r/   z$AstConditionLevel.visit_IfClauseNodej   sn    % 	AHHTN	>>  A% NN!!$'  A%  r   c                    | j                  |       | xj                  dz  c_        |j                  j                  |        |j                  j                  |        | xj                  dz  c_        y r   )r   rL   r1   r   r(   r   s     r   r2   zAstConditionLevel.visit_IfNodes   sV    %!d#

$!r   Nr3   r6   r7   r8   r9   )r:   r;   r<   r   r   r)   r/   r2   r=   r   r   rI   rI   \   s    !4"&"r   rI   )
__future__r   visitorr   typingTTYPE_CHECKING r   r	   r?   rI   r=   r   r   <module>rW      s?   " #  ??6j 6p	 Z 	 "
 "r   