parameters: (blocks, args)
docstring: Replace ir.FreeVar(...) with real variables from parent function
docstring_summary: Replace ir.FreeVar(...) with real variables from parent function
docstring_tokens: Replace ir . FreeVar ( ... ) with real variables from parent function
function: def _replace_freevars(blocks, args):
      """
      Replace ir.FreeVar(...) with real variables from parent function
      """
      for label, block in blocks.items():
          assigns = block.find_insts(ir.Assign)
          for stmt in assigns:
              if isinstance(stmt.value, ir.FreeVar):
                  idx = stmt.value.index
                  assert(idx < len(args))
                  if isinstance(args[idx], ir.Var):
                      stmt.value = args[idx]
                  else:
                      stmt.value = ir.Const(args[idx], stmt.loc)
function_tokens: def _replace_freevars ( blocks , args ) : for label , block in blocks . items ( ) : assigns = block . find_insts ( ir . Assign ) for stmt in assigns : if isinstance ( stmt . value , ir . FreeVar ) : idx = stmt . value . index assert ( idx < len ( args ) ) if isinstance ( args [ idx ] , ir . Var ) : stmt . value = args [ idx ] else : stmt . value = ir . Const ( args [ idx ] , stmt . loc )