view python/ir/value.py @ 167:0b5b2ee6b435

Added 2 unit tests
author Windel Bouwman
date Fri, 22 Mar 2013 17:40:13 +0100
parents 9683a4cd848f
children
line wrap: on
line source


class Value:
   def __init__(self, vty=None):
      self.valueType = vty
      self.name = None
   def getContext(self):
      return self.valueType.context
   def dump(self):
      print(self)
   def getName(self):
      return self.name
   def setName(self, name):
      if not self.name and not name:
         return
      self.name = name
   Name = property(getName, setName)
   def __repr__(self):
      return 'VALUE {0}'.format(self.name)

class Constant(Value):
   def __init__(self, value, vty):
      super().__init__(vty)
      self.value = value
      print('new constant value: ', value)