def definition(self): # return a program object or None if not hasattr(self, "_definition"): if self.typ == Art.ExpConstUse or self.typ == Art.ExpValueUse: self._definition = Program(Artutils.peekExpArg(self.fo, 0)) else: self._definition = None return self._definition
def subexps(self): # subexps: right now we have a special case to find the subexps # of a basic expression, because the C function won't let us, # and everything else just calls the C. this is not quite # correct, because there are certain things that are not basic # values but still don't have subexpressions, but we don't deal # with those things right now. however, regardless of # correctness, it might make more sense in the future to switch # the type of special-casing: only call peekExpArg if our typ # meets certain conditions which are known to work, and # otherwise don't. #print "about to find subexps of", self.name() if isBasicExp(self.typ): se = [] else: se = [Program(Artutils.peekExpArg(self.fo, n)) for n in range(0, self.arity+1)] #print "the subexps of", self.name(), "are", se return se