Skip to content

Commit

Permalink
refact(rivet.codegen): skip '@Assert' calls in release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS authored Oct 10, 2023
1 parent a6a29d6 commit 365d0d6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions rivetc/src/codegen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ def gen_expr(self, expr, custom_tmp = None):
self.cur_fn.add_label(l1)
self.cur_fn.add_ret_void()
self.cur_fn.add_label(l2)
else:
elif self.comp.prefs.build_mode != prefs.BuildMode.Release:
self.cur_fn.add_call(
"_R4core6assertF", [
self.gen_expr(expr.args[0]),
Expand All @@ -966,9 +966,8 @@ def gen_expr(self, expr, custom_tmp = None):
)
elif expr.name == "unreachable":
self.panic("entered unreachable code")
elif expr.name == "breakpoint":
if self.comp.prefs.build_mode != prefs.BuildMode.Release:
self.cur_fn.breakpoint()
elif expr.name == "breakpoint" and self.comp.prefs.build_mode != prefs.BuildMode.Release:
self.cur_fn.breakpoint()
elif isinstance(expr, ast.TupleLiteral):
expr_sym = expr.typ.symbol()
tmp = ir.Ident(self.ir_type(expr.typ), self.cur_fn.local_name())
Expand Down

0 comments on commit 365d0d6

Please sign in to comment.