#NEWLINE# def AddASTNodeToGraph( self , parent_index , ast_node ) : #NEWLINE# #INDENT# " Creates a Graph Node from the given AST node,\n        marks its parent as the graph node with the given\n        `parent_index`, and recurses on the given AST\n        node's children." #NEWLINE# node_index = self . __CreateGraphNodeFromAST ( ast_node ) #NEWLINE# if ( parent_index is not None ) : #NEWLINE# #INDENT# self . graph . add_edge ( parent_index , node_index ) #NEWLINE# #UNINDENT# children = ast_node . GetChildren ( ) #NEWLINE# for child in children : #NEWLINE# #INDENT# if ( child is None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( type ( child ) is list ) : #NEWLINE# #INDENT# empty_node = self . __CreateEmptyGraphNode ( ) #NEWLINE# self . graph . add_edge ( node_index , empty_node ) #NEWLINE# for node in child : #NEWLINE# #INDENT# self . AddASTNodeToGraph ( empty_node , node ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( child , N . Node ) : #NEWLINE# #INDENT# self . AddASTNodeToGraph ( node_index , child ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( child is None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# U . ExitWithError ( ( "%s's child (type: %s) was supposed to be a Node!\n %s" % ( ast_node . GetName ( ) , type ( child ) , ast_node ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return