class_docstr: Gather aliasing informations across nodes
  
  As a result, each node from the module is associated to a set of node or
  Intrinsic to which it *may* alias to.
class_docstr_tok: ["Gather","aliasing","informations","across","nodes","As","a","result",",","each","node","from","the","module","is","associated","to","a","set","of","node","or","Intrinsic","to","which","it","*","may","*","alias","to","."]
docstr: After an if statement, the values from both branches are merged,
  potentially creating more aliasing:
  
  >>> from pythran import passmanager
  >>> pm = passmanager.PassManager('demo')
  >>> fun = """
  ... def foo(a, b):
  ...     if a: c=a
  ...     else: c=b
  ...     return {c}"""
  >>> module = ast.parse(fun)
  >>> result = pm.gather(Aliases, module)
  >>> Aliases.dump(result, filter=ast.Set)
  {c} => ['|a|, |b|']
docstr_tok: ["After","an","if","statement",",","the","values","from","both","branches","are","merged",",","potentially","creating","more","aliasing",":",">",">",">","from","pythran","import","passmanager",">",">",">","pm","=","passmanager.PassManager","(","'demo","'",")",">",">",">","fun","=","``","''","''","...","def","foo","(","a",",","b",")",":","...","if","a",":","c=a","...","else",":","c=b","...","return","{","c","}","''","''","''",">",">",">","module","=","ast.parse","(","fun",")",">",">",">","result","=","pm.gather","(","Aliases",",","module",")",">",">",">","Aliases.dump","(","result",",","filter=ast.Set",")","{","c","}","=",">","[","'|a|",",","|b|","'","]"]
code: def visit_If(self, node):
      '''
      After an if statement, the values from both branches are merged,
      potentially creating more aliasing:
  
      >>> from pythran import passmanager
      >>> pm = passmanager.PassManager('demo')
      >>> fun = """
      ... def foo(a, b):
      ...     if a: c=a
      ...     else: c=b
      ...     return {c}"""
      >>> module = ast.parse(fun)
      >>> result = pm.gather(Aliases, module)
      >>> Aliases.dump(result, filter=ast.Set)
      {c} => ['|a|, |b|']
      '''
  
      md.visit(self, node)
      self.visit(node.test)
      true_aliases = false_aliases = None
  
      # first try the true branch
      try:
          self.aliases = DictLayer(self.aliases)
          for stmt in node.body:
              self.visit(stmt)
          true_aliases = self.aliases
      except UnboundIdentifierError:
          pass
      finally:
          self.aliases = self.aliases.base
  
      # then try the false branch
      try:
          self.aliases = DictLayer(self.aliases)
          for stmt in node.orelse:
              self.visit(stmt)
          false_aliases = self.aliases
      except UnboundIdentifierError:
          pass
      finally:
          self.aliases = self.aliases.base
  
      if true_aliases and not false_aliases:
          self.aliases = DictLayer(true_aliases)
          for stmt in node.orelse:
              self.visit(stmt)
          false_aliases = self.aliases
          self.aliases = self.aliases.base
  
      if false_aliases and not true_aliases:
          self.aliases = DictLayer(false_aliases)
          for stmt in node.body:
              self.visit(stmt)
          true_aliases = self.aliases
          self.aliases = self.aliases.base
  
      # merge the results from true and false branches
      for k, v in true_aliases.layer.items():
          if k in false_aliases.layer:
              self.aliases[k] = v.union(false_aliases[k])
          elif k in self.aliases:
              self.aliases[k] = v.union(self.aliases[k])
          else:
              self.aliases[k] = v
      for k, v in false_aliases.layer.items():
          if k in true_aliases.layer:
              pass  # already done
          elif k in self.aliases:
              self.aliases[k] = v.union(self.aliases[k])
          else:
              self.aliases[k] = v
  
imports: from pythran.analyses.global_declarations import GlobalDeclarations
  from pythran.intrinsic import Intrinsic, Class, UnboundValue
  from pythran.passmanager import ModuleAnalysis
  from pythran.tables import functions, methods, MODULES
  from pythran.unparse import Unparser
  from pythran.conversion import demangle
  import pythran.metadata
  from pythran.utils import isnum
  from pythran.syntax import PythranSyntaxError
  import gast
  from copy import deepcopy
  from itertools import product
  import io
label_desc: Use image node_id 26 for calling the Aliases obj's underlying member method code with example usage: obj.visit_If(node) without return types