py2llvm/ast_body: pep8

This commit is contained in:
Sebastien Bourdeauducq 2014-10-14 00:08:42 +08:00
parent a303293e8f
commit 594b3dda74
1 changed files with 9 additions and 6 deletions

View File

@ -150,7 +150,6 @@ class Visitor:
return result return result
def _visit_expr_Compare(self, node): def _visit_expr_Compare(self, node):
comparisons = [] comparisons = []
old_comparator = self.visit_expression(node.left) old_comparator = self.visit_expression(node.left)
@ -367,7 +366,8 @@ class Visitor:
def _visit_stmt_Raise(self, node): def _visit_stmt_Raise(self, node):
if self._active_exception_stack: if self._active_exception_stack:
finally_block, propagate, propagate_eid = self._active_exception_stack[-1] finally_block, propagate, propagate_eid = (
self._active_exception_stack[-1])
self.builder.store(lc.Constant.int(lc.Type.int(1), 1), propagate) self.builder.store(lc.Constant.int(lc.Type.int(1), 1), propagate)
if node.exc is not None: if node.exc is not None:
eid = lc.Constant.int(lc.Type.int(), node.exc.args[0].n) eid = lc.Constant.int(lc.Type.int(), node.exc.args[0].n)
@ -377,7 +377,8 @@ class Visitor:
eid = lc.Constant.int(lc.Type.int(), node.exc.args[0].n) eid = lc.Constant.int(lc.Type.int(), node.exc.args[0].n)
self.env.build_raise(self.builder, eid) self.env.build_raise(self.builder, eid)
def _handle_exception(self, function, finally_block, propagate, propagate_eid, handlers): def _handle_exception(self, function, finally_block,
propagate, propagate_eid, handlers):
eid = self.env.build_getid(self.builder) eid = self.env.build_getid(self.builder)
self._active_exception_stack.append( self._active_exception_stack.append(
(finally_block, propagate, propagate_eid)) (finally_block, propagate, propagate_eid))
@ -422,9 +423,11 @@ class Visitor:
exc_block = function.append_basic_block("try_exc") exc_block = function.append_basic_block("try_exc")
finally_block = function.append_basic_block("try_finally") finally_block = function.append_basic_block("try_finally")
propagate = self.builder.alloca(lc.Type.int(1), name="propagate") propagate = self.builder.alloca(lc.Type.int(1),
name="propagate")
self.builder.store(lc.Constant.int(lc.Type.int(1), 0), propagate) self.builder.store(lc.Constant.int(lc.Type.int(1), 0), propagate)
propagate_eid = self.builder.alloca(lc.Type.int(), name="propagate_eid") propagate_eid = self.builder.alloca(lc.Type.int(),
name="propagate_eid")
exception_occured = self.env.build_catch(self.builder) exception_occured = self.env.build_catch(self.builder)
self.builder.cbranch(exception_occured, exc_block, noexc_block) self.builder.cbranch(exception_occured, exc_block, noexc_block)