#NEWLINE# def onEnterNode( self , node ) : #NEWLINE# #INDENT# if node . isExpressionTargetVariableRef ( ) : #NEWLINE# #INDENT# provider = node . getParentVariableProvider ( ) #NEWLINE# if ( node . getVariable ( ) is None ) : #NEWLINE# #INDENT# variable_name = node . getVariableName ( ) #NEWLINE# variable = provider . getVariableForAssignment ( variable_name = variable_name ) #NEWLINE# node . setVariable ( variable ) #NEWLINE# #UNINDENT# addVariableUsage ( node . getVariable ( ) , provider ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if node . isExpressionTargetTempVariableRef ( ) : #NEWLINE# #INDENT# provider = node . getParentVariableProvider ( ) #NEWLINE# addVariableUsage ( node . getVariable ( ) , provider ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if node . isExpressionVariableRef ( ) : #NEWLINE# #INDENT# if ( node . getVariable ( ) is None ) : #NEWLINE# #INDENT# provider = node . getParentVariableProvider ( ) #NEWLINE# if provider . isEarlyClosure ( ) : #NEWLINE# #INDENT# variable = provider . getVariableForReference ( variable_name = node . getVariableName ( ) ) #NEWLINE# if ( variable . getOwner ( ) is not provider ) : #NEWLINE# #INDENT# if ( ( python_version >= 340 ) or ( ( python_version >= 300 ) and variable . isModuleVariable ( ) ) ) : #NEWLINE# #INDENT# variable = Variables . MaybeLocalVariable ( owner = provider , maybe_variable = variable ) #NEWLINE# #UNINDENT# #UNINDENT# node . setVariable ( variable ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if node . isExpressionTempVariableRef ( ) : #NEWLINE# #INDENT# if ( node . getVariable ( ) . getOwner ( ) != node . getParentVariableProvider ( ) ) : #NEWLINE# #INDENT# node . setVariable ( node . getParentVariableProvider ( ) . addClosureVariable ( node . getVariable ( ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if node . isExpressionGeneratorObjectBody ( ) : #NEWLINE# #INDENT# self . _handleNonLocal ( node ) #NEWLINE# if ( python_version >= 340 ) : #NEWLINE# #INDENT# self . _handleQualnameSetup ( node ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if node . isExpressionCoroutineObjectBody ( ) : #NEWLINE# #INDENT# self . _handleNonLocal ( node ) #NEWLINE# self . _handleQualnameSetup ( node ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if node . isExpressionClassBody ( ) : #NEWLINE# #INDENT# self . _handleNonLocal ( node ) #NEWLINE# if ( python_version >= 340 ) : #NEWLINE# #INDENT# self . _handleQualnameSetup ( node ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if node . isExpressionFunctionBody ( ) : #NEWLINE# #INDENT# self . _handleNonLocal ( node ) #NEWLINE# for variable in node . getParameters ( ) . getAllVariables ( ) : #NEWLINE# #INDENT# addVariableUsage ( variable , self ) #NEWLINE# #UNINDENT# if ( python_version >= 340 ) : #NEWLINE# #INDENT# self . _handleQualnameSetup ( node ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( node . isExpressionAttributeLookup ( ) or node . isStatementAssignmentAttribute ( ) or node . isStatementDelAttribute ( ) ) : #NEWLINE# #INDENT# attribute_name = node . getAttributeName ( ) #NEWLINE# if ( attribute_name . startswith ( '__' ) and ( not attribute_name . endswith ( '__' ) ) ) : #NEWLINE# #INDENT# seen_function = False #NEWLINE# current = node #NEWLINE# while True : #NEWLINE# #INDENT# current = current . getParentVariableProvider ( ) #NEWLINE# if current . isCompiledPythonModule ( ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# if current . isExpressionClassBody ( ) : #NEWLINE# #INDENT# if seen_function : #NEWLINE# #INDENT# node . setAttributeName ( ( '_%s%s' % ( current . getName ( ) . lstrip ( '_' ) , attribute_name ) ) ) #NEWLINE# #UNINDENT# break #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# seen_function = True #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( node . isStatementLoopBreak ( ) or node . isStatementLoopContinue ( ) ) : #NEWLINE# #INDENT# current = node #NEWLINE# while True : #NEWLINE# #INDENT# if current . isParentVariableProvider ( ) : #NEWLINE# #INDENT# if node . isStatementLoopContinue ( ) : #NEWLINE# #INDENT# message = "'continue' not properly in loop" #NEWLINE# col_offset = ( 16 if ( python_version >= 300 ) else None ) #NEWLINE# display_line = True #NEWLINE# source_line = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# message = "'break' outside loop" #NEWLINE# if isFullCompat ( ) : #NEWLINE# #INDENT# col_offset = ( 2 if ( python_version >= 300 ) else None ) #NEWLINE# display_line = True #NEWLINE# source_line = ( '' if ( python_version >= 300 ) else None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# col_offset = 13 #NEWLINE# display_line = True #NEWLINE# source_line = None #NEWLINE# #UNINDENT# #UNINDENT# SyntaxErrors . raiseSyntaxError ( message , source_ref = node . getSourceReference ( ) , col_offset = col_offset , display_line = display_line , source_line = source_line ) #NEWLINE# #UNINDENT# current = current . getParent ( ) #NEWLINE# if current . isStatementLoop ( ) : #NEWLINE# #INDENT# break