parameters: (blocks, namedict)
docstring: replace variables (ir.Var to ir.Var) from dictionary (name -> name)
docstring_summary: replace variables (ir.Var to ir.Var) from dictionary (name -> name)
docstring_tokens: replace variables ( ir . Var to ir . Var ) from dictionary ( name - > name )
function: def replace_var_names(blocks, namedict):
      """replace variables (ir.Var to ir.Var) from dictionary (name -> name)"""
      # remove identity values to avoid infinite loop
      new_namedict = {}
      for l, r in namedict.items():
          if l != r:
              new_namedict[l] = r
  
      def replace_name(var, namedict):
          assert isinstance(var, ir.Var)
          while var.name in namedict:
              var = ir.Var(var.scope, namedict[var.name], var.loc)
          return var
      visit_vars(blocks, replace_name, new_namedict)
function_tokens: def replace_var_names ( blocks , namedict ) : # remove identity values to avoid infinite loop new_namedict = { } for l , r in namedict . items ( ) : if l != r : new_namedict [ l ] = r def replace_name ( var , namedict ) : assert isinstance ( var , ir . Var ) while var . name in namedict : var = ir . Var ( var . scope , namedict [ var . name ] , var . loc ) return var visit_vars ( blocks , replace_name , new_namedict )