From 3d75cd2863a0737b4204bed61050d1b3cb272dd2 Mon Sep 17 00:00:00 2001 From: StunxFS Date: Sat, 11 Nov 2023 21:39:15 -0400 Subject: [PATCH] chore(rivetc.codegen): format code --- rivetc/src/codegen/__init__.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/rivetc/src/codegen/__init__.py b/rivetc/src/codegen/__init__.py index ea5990b49..4b7cf68f8 100644 --- a/rivetc/src/codegen/__init__.py +++ b/rivetc/src/codegen/__init__.py @@ -2330,7 +2330,9 @@ def gen_expr(self, expr, custom_tmp = None): self.gen_expr(self.while_continue_expr) self.cur_fn.add_br(self.loop_entry_label) else: - self.gen_defer_stmts(scope = expr.scope, run_defer_previous = True) + self.gen_defer_stmts( + scope = expr.scope, run_defer_previous = True + ) self.cur_fn.add_br(self.loop_exit_label) return ir.Skip() elif isinstance(expr, ast.ReturnExpr): @@ -2343,7 +2345,9 @@ def gen_expr(self, expr, custom_tmp = None): ir.Name("result") ), ir.IntLit(ir.UINT8_T, "1") ) - self.gen_defer_stmts(scope = expr.scope, run_defer_previous = True) + self.gen_defer_stmts( + scope = expr.scope, run_defer_previous = True + ) self.cur_fn.add_ret_void() elif expr.has_expr: is_array = self.cur_fn_ret_typ.symbol().kind == TypeKind.Array @@ -2366,13 +2370,19 @@ def gen_expr(self, expr, custom_tmp = None): expr_ = tmp if wrap_result: expr_ = self.result_value(self.cur_fn_ret_typ, expr_) - self.gen_defer_stmts(scope = expr.scope, run_defer_previous = True) + self.gen_defer_stmts( + scope = expr.scope, run_defer_previous = True + ) self.cur_fn.add_ret(expr_) elif wrap_result: - self.gen_defer_stmts(scope = expr.scope, run_defer_previous = True) + self.gen_defer_stmts( + scope = expr.scope, run_defer_previous = True + ) self.cur_fn.add_ret(self.result_void(self.cur_fn_ret_typ)) else: - self.gen_defer_stmts(scope = expr.scope, run_defer_previous = True) + self.gen_defer_stmts( + scope = expr.scope, run_defer_previous = True + ) self.cur_fn.add_ret_void() return ir.Skip() elif isinstance(expr, ast.ThrowExpr): @@ -2461,8 +2471,10 @@ def gen_defer_stmts( ): for i in range(len(self.cur_fn_defer_stmts) - 1, -1, -1): defer_stmt = self.cur_fn_defer_stmts[i] - if not ((run_defer_previous and scope.start >= defer_stmt.scope.start) or - (scope.start == defer_stmt.scope.start)): + if not ( + (run_defer_previous and scope.start >= defer_stmt.scope.start) + or (scope.start == defer_stmt.scope.start) + ): continue if defer_stmt.mode == ast.DeferMode.ERROR and not gen_errdefer: # Should be run only when an error occurs