def _raise(self, x=None, y=None, z=None): if x is not None: assertResult(x, "raise") x = topy(x) if y is not None: assertResult(y, "raise") y = topy(y) if z is not None: assertResult(z, "raise") z = topy(z) return ast.Raise(x, y, z)
def visitAugAssign(self, node): if isinstance(node.node, ast.Name) and ( not self.locals or node.node.name not in flatten(self.locals)): name = node.node.name node.node = ast.Subscript(ast.Name('data'), 'OP_APPLY', [ast.Const(name)]) node.expr = self.visit(node.expr) return ast.If( [(ast.Compare(ast.Const(name), [('in', ast.Name('data'))]), ast.Stmt([node]))], ast.Stmt([ ast.Raise( ast.CallFunc(ast.Name('UndefinedError'), [ast.Const(name)]), None, None) ])) else: return ASTTransformer.visitAugAssign(self, node)
def _do_RaiseStatement(self, node): expr1 = self.transform(node.ExceptionType) expr2 = self.transform(node.Value) expr3 = self.transform(node.TraceBack) return ast.Raise(expr1, expr2, expr3)