view python/ir/value.py @ 163:8104fc8b5e90

Added visitor to c3
author Windel Bouwman
date Mon, 18 Mar 2013 20:13:57 +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)