view python/ir/function.py @ 192:6cd6260789a1

Added more tests for parser generator
author Windel Bouwman
date Sun, 26 May 2013 23:19:27 +0200
parents 460db5669efa
children d77cb5962cc5
line wrap: on
line source

from .basicblock import BasicBlock

class Function:
   def __init__(self, name):
      self.name = name
      self.bbs = []
      self.entry = None
   def __repr__(self):
      return 'Function {0}'.format(self.name)
   def addBB(self, bb):
      self.bbs.append(bb)
      bb.parent = self
   def removeBasicBlock(self, bb):
      self.bbs.remove(bb)
      bb.parent = None
   def getBBs(self):
      return self.bbs
   BasicBlocks = property(getBBs)