def setvar(self, var, val): if var.concretetype is not lltype.Void: try: val = lltype.enforce(var.concretetype, val) except TypeError: assert False, "type error: input value of type:\n\n\t%r\n\n===> variable of type:\n\n\t%r\n" % (lltype.typeOf(val), var.concretetype) assert isinstance(var, Variable) self.bindings[var] = val
def getval(self, varorconst): try: val = varorconst.value except AttributeError: val = self.bindings[varorconst] if isinstance(val, ComputedIntSymbolic): val = val.compute_fn() if varorconst.concretetype is not lltype.Void: try: val = lltype.enforce(varorconst.concretetype, val) except TypeError: assert False, "type error: %r val from %r var/const" % (lltype.typeOf(val), varorconst.concretetype) return val