def visit_fn(self, fn):

    all_scalars = True 
    self.type_env = fn.type_env 
    # every name at least aliases it self
    for (name,t) in fn.type_env.iteritems():

      if self.immutable_type(t):
        self.immutable.add(name)
      else:
        self.may_alias[name] = set([name])
        all_scalars = False

    if all_scalars:
      return  
    
    # every arg also aliases at least all the other input of the same type 
    # unless we were told it's a freshly allocated input
    
      
    reverse_type_mapping = {}
      
    for name in fn.arg_names:
      if name not in self.fresh_alloc_args:
        t = fn.type_env[name]
        for nested_t in self.nested_mutable_types(t):
          reverse_type_mapping.setdefault(nested_t, set([])).add(name)

      
    for name in fn.arg_names:
      # 
      # Every input argument should alias the other inputs of the same type 
      # if they are both arrays or tuples which contain arrays 
      # We must exclude, however, arguments which we're told explicitly were
      # freshly allocated before we entered the function 
      if self.fresh_alloc_args not in name:
        t = fn.type_env[name]
        for nested_t in self.nested_mutable_types(t):
          self.may_alias[name].update(reverse_type_mapping[nested_t])

    self.visit_block(fn.body)
    
    # once we've accumulated all the aliases
    # anyone who points into the input data 
    # is also considered to be escaping 
    for name in fn.arg_names:
      if name not in self.immutable and name not in self.fresh_alloc_args:
        self.may_escape.update(self.may_alias[name])
    
    if config.print_escape_analysis: 
      print "[EscapeAnalysis] In function %s" % (fn.cache_key, )
      print "-------"
      print fn 
      print 
      print "aliases"
      print "-------"
      for (k,aliases) in sorted(self.may_alias.items(), key = lambda (k,_): k):
        print "  %s => %s" % (k, aliases)
      print 
      print "escape set"
      print "----------"
      print sorted(self.may_escape)
dataset/ETHPy150Open iskandr/parakeet/parakeet/analysis/escape_analysis.py/EscapeAnalysis.visit_fn/swapped operands of `not in`