#NEWLINE# def inline_operator( dest_op , var , target_op ) : #NEWLINE# #INDENT# 'Convert two operator trees into one by inlining.\n\n    :param dest_op: The Operator that is the inline destination\n    :param var: The variable name (String) to replace.\n    :param target_op: The operation to replace.\n    ' #NEWLINE# has_inlined = [ False ] #NEWLINE# def rewrite_node( node ) : #NEWLINE# #INDENT# if ( isinstance ( node , ScanTemp ) and ( node . name == var ) ) : #NEWLINE# #INDENT# if has_inlined [ 0 ] : #NEWLINE# #INDENT# return copy . deepcopy ( target_op ) #NEWLINE# #UNINDENT# has_inlined [ 0 ] = True #NEWLINE# return target_op #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return node . apply ( rewrite_node ) #NEWLINE# #UNINDENT# #UNINDENT# return rewrite_node ( dest_op )