#NEWLINE# def visit_Scope( self , node ) : #NEWLINE# #INDENT# scope = [ ] #NEWLINE# for a in node . args : #NEWLINE# #INDENT# if isinstance ( a , module . GenerateIf ) : #NEWLINE# #INDENT# if ( a . true_scope is None ) : #NEWLINE# #INDENT# raise TypeError ( 'GenerateIf statement without scope namecan not be used as an scope index.' ) #NEWLINE# #UNINDENT# scope . append ( vast . IdentifierScopeLabel ( a . true_scope ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( a , module . GenerateIfElse ) : #NEWLINE# #INDENT# if ( a . false_scope is None ) : #NEWLINE# #INDENT# raise TypeError ( 'GenerateIfElse statement without scope namecan not be used as an scope index.' ) #NEWLINE# #UNINDENT# scope . append ( vast . IdentifierScopeLabel ( a . false_scope ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( a , module . GenerateFor ) : #NEWLINE# #INDENT# raise TypeError ( "Scope index must not be GenerateFor. Use slice, like 'obj[index]'" ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( a , vtypes . ScopeIndex ) : #NEWLINE# #INDENT# scope . append ( self . visit ( a ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( a , str ) : #NEWLINE# #INDENT# scope . append ( vast . IdentifierScopeLabel ( a ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# _id = self . visit ( a ) #NEWLINE# if ( not isinstance ( _id , vast . Identifier ) ) : #NEWLINE# #INDENT# raise TypeError ( ( 'Cannot convert into IdentifierScopeLabel from %s.' % str ( type ( _id ) ) ) ) #NEWLINE# #UNINDENT# scope . append ( vast . IdentifierScopeLabel ( _id . name ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( len ( scope ) == 1 ) : #NEWLINE# #INDENT# return vast . Identifier ( scope [ 0 ] . name ) #NEWLINE# #UNINDENT# return vast . Identifier ( scope [ ( - 1 ) ] . name , vast . IdentifierScope ( tuple ( scope [ : ( - 1 ) ] ) ) )