1
0
forked from M-Labs/nac3

core/irrt: fix error context check logic error

This commit is contained in:
lyken 2024-07-26 16:21:25 +08:00
parent e14eba05d2
commit fc9d47fb54
2 changed files with 5 additions and 5 deletions

View File

@ -72,8 +72,8 @@ void __nac3_error_context_initialize(ErrorContext *errctx,
errctx->initialize(error_ids);
}
bool __nac3_error_context_has_no_error(ErrorContext *errctx) {
return !errctx->has_error();
bool __nac3_error_context_has_error(ErrorContext *errctx) {
return errctx->has_error();
}
void __nac3_error_context_get_error_str(ErrorContext *errctx,

View File

@ -100,11 +100,11 @@ pub fn call_nac3_error_context_initialize<'ctx>(
.returning_void();
}
pub fn call_nac3_error_context_has_no_error<'ctx>(
pub fn call_nac3_error_context_has_error<'ctx>(
ctx: &CodeGenContext<'ctx, '_>,
errctx: Pointer<'ctx, StructModel<ErrorContext>>,
) -> NInt<'ctx, Bool> {
FunctionBuilder::begin(ctx, "__nac3_error_context_has_no_error")
FunctionBuilder::begin(ctx, "__nac3_error_context_has_error")
.arg("errctx", errctx)
.returning("has_error", NIntModel(Bool))
}
@ -157,7 +157,7 @@ pub fn check_error_context<'ctx, G: CodeGenerator + ?Sized>(
let end_bb = ctx.ctx.insert_basic_block_after(irrt_has_error_bb, "end");
// Inserting into `current_bb`
let has_error = call_nac3_error_context_has_no_error(ctx, errctx_ptr);
let has_error = call_nac3_error_context_has_error(ctx, errctx_ptr);
ctx.builder.build_conditional_branch(has_error.value, irrt_has_error_bb, end_bb).unwrap();
// Inserting into `irrt_has_error_bb`