def compute_types(self): box2classes = {} # box --> [ootype.Class] self._collect_types(self.cliloop.operations, box2classes) for box, classes in box2classes.iteritems(): cls = classes[0] for cls2 in classes[1:]: if ootype.subclassof(cls, cls2): cls = cls2 else: assert ootype.subclassof(cls2, cls) self.box2type[box] = dotnet.class2type(cls)
def _auto_propagate(self, link, block): assert block.exitswitch is flowmodel.c_last_exception if not self.auto_propagate_exceptions: return False if not self._is_raise_block(link.target): return False llexc = link.llexitcase i = list(block.exits).index(link) next_links = block.exits[i+1:] for next_link in next_links: # if one of the next links catches a superclass of llexc, we # *have* to insert a catch block here, else the exception might be # caught by the wrong one if ootype.subclassof(llexc, next_link.llexitcase): return False # if all the checks were ok, it's safe to avoid the catch block and # let the exception propagate return True
def _auto_propagate(self, link, block): assert block.exitswitch is flowmodel.c_last_exception if not self.auto_propagate_exceptions: return False if not self._is_raise_block(link.target): return False llexc = link.llexitcase i = list(block.exits).index(link) next_links = block.exits[i + 1:] for next_link in next_links: # if one of the next links catches a superclass of llexc, we # *have* to insert a catch block here, else the exception might be # caught by the wrong one if ootype.subclassof(llexc, next_link.llexitcase): return False # if all the checks were ok, it's safe to avoid the catch block and # let the exception propagate return True
def ll_issubclass(class1, class2): # helper for exceptiondata.py return ootype.subclassof(class1, class2)
def ll_isinstance(inst, class_): c1 = ootype.classof(inst) return ootype.subclassof(c1, class_)
def op_subclassof(class1, class2): return ootype.subclassof(class1, class2)