WIP - Fix string-like format

This commit is contained in:
David Mak 2024-08-12 17:02:26 +08:00
parent 2707735274
commit 45a549fb01
1 changed files with 8 additions and 3 deletions

View File

@ -842,10 +842,10 @@ fn polymorphic_print<'ctx>(
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 true_len = unsafe { true_str.get_field_at_index_unchecked(1) }.into_int_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();
let false_len = unsafe { false_str.get_field_at_index_unchecked(1) }.into_int_value();
let bool_val = generator.bool_to_i1(ctx, value.into_int_value());
@ -888,7 +888,12 @@ fn polymorphic_print<'ctx>(
} else {
fmt.push_str("%.*s");
}
args.push(value);
let str = value.into_struct_value();
let str_data = unsafe { str.get_field_at_index_unchecked(0) }.into_pointer_value();
let str_len = unsafe { str.get_field_at_index_unchecked(1) }.into_int_value();
args.extend(&[str_len.into(), str_data.into()]);
}
TypeEnum::TObj { obj_id, params, .. } if *obj_id == PrimDef::List.id() => {