Skip to content

Commit

Permalink
fix Throwable usage
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Jan 16, 2024
1 parent 8893c02 commit b43081c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions rivetc/src/codegen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ def gen_expr(self, expr, custom_tmp = None):
)
is_vtable_call = True
if not isinstance(self_expr.typ, ir.Pointer):
self_expr = ir.Inst(ir.InstKind.LoadPtr, [self_expr], self_expr.typ.typ)
self_expr = ir.Inst(ir.InstKind.LoadPtr, [self_expr], self_expr.typ)
if left_sym.kind == TypeKind.Trait:
if left2_sym.kind == TypeKind.Trait and left_sym != left2_sym:
id_value = ir.Inst(
Expand Down Expand Up @@ -1345,7 +1345,7 @@ def gen_expr(self, expr, custom_tmp = None):
self.cur_func.add_call(
"_R4core15uncatched_errorF", [
ir.Selector(
self.ir_type(self.comp.throwable_t),
self.ir_type(self.comp.throwable_t).ptr(True),
res_value, ir.Name("err")
)
]
Expand All @@ -1355,7 +1355,7 @@ def gen_expr(self, expr, custom_tmp = None):
self.cur_func.add_call(
"_R4core18test_error_throwedF", [
ir.Selector(
self.ir_type(self.comp.throwable_t),
self.ir_type(self.comp.throwable_t).ptr(True),
res_value, ir.Name("err")
),
self.gen_string_literal(pos),
Expand All @@ -1373,11 +1373,11 @@ def gen_expr(self, expr, custom_tmp = None):
)
self.cur_func.store(
ir.Selector(
self.ir_type(self.comp.throwable_t), tmp2,
self.ir_type(self.comp.throwable_t).ptr(True), tmp2,
ir.Name("err")
),
ir.Selector(
self.ir_type(self.comp.throwable_t),
self.ir_type(self.comp.throwable_t).ptr(True),
res_value, ir.Name("err")
)
)
Expand All @@ -1399,10 +1399,10 @@ def gen_expr(self, expr, custom_tmp = None):
expr.err_handler.varname, err_ir_name
)
self.cur_func.inline_alloca(
self.ir_type(self.comp.throwable_t),
self.ir_type(self.comp.throwable_t).ptr(True),
err_ir_name,
ir.Selector(
self.ir_type(self.comp.throwable_t),
self.ir_type(self.comp.throwable_t).ptr(True),
res_value, ir.Name("err")
)
)
Expand Down Expand Up @@ -2469,7 +2469,7 @@ def result_error(self, typ, expr_t, expr):
)
self.cur_func.store(
ir.Selector(
self.ir_type(self.comp.throwable_t), tmp, ir.Name("err")
self.ir_type(self.comp.throwable_t).ptr(True), tmp, ir.Name("err")
), self.trait_value(expr, expr_t, self.comp.throwable_t)
)
return tmp
Expand Down Expand Up @@ -2868,7 +2868,7 @@ def ir_type(self, typ, gen_self_arg = False):
),
ir.Field("is_err", ir.BOOL_T),
ir.Field(
"err", self.ir_type(self.comp.throwable_t)
"err", self.ir_type(self.comp.throwable_t).ptr(True)
)
]
)
Expand Down

0 comments on commit b43081c

Please sign in to comment.