WIP - Fix bool format

This commit is contained in:
David Mak 2024-08-12 16:56:43 +08:00
parent dbbc4ed78c
commit 4920989c00
1 changed files with 10 additions and 10 deletions

View File

@ -849,18 +849,18 @@ fn polymorphic_print<'ctx>(
fmt.push_str("%.*s");
let true_str = ctx.gen_string(generator, "True");
let true_data = unsafe { true_str.get_field_at_index_unchecked(0) }.into_pointer_value();
let true_len = unsafe { true_str.get_field_at_index_unchecked(1) }.into_pointer_value();
let false_str = ctx.gen_string(generator, "False");
let false_data = unsafe { false_str.get_field_at_index_unchecked(0) }.into_pointer_value();
let false_len = unsafe { false_str.get_field_at_index_unchecked(1) }.into_pointer_value();
args.push(
ctx.builder
.build_select(
generator.bool_to_i1(ctx, value.into_int_value()),
true_str,
false_str,
"",
)
.unwrap(),
);
let bool_val = generator.bool_to_i1(ctx, value.into_int_value());
args.extend([
ctx.builder.build_select(bool_val, true_len, false_len, "").unwrap(),
ctx.builder.build_select(bool_val, true_data, false_data, "").unwrap(),
]);
}
TypeEnum::TObj { obj_id, .. }