forked from M-Labs/nac3
1
0
Fork 0

WIP10 - Debug statements again

This commit is contained in:
David Mak 2024-08-12 15:06:12 +08:00
parent 6793563a7c
commit 89d52b310c
1 changed files with 3 additions and 1 deletions

View File

@ -761,6 +761,8 @@ fn polymorphic_print<'ctx>(
ctx.module.add_function(fn_name, fn_t, None) ctx.module.add_function(fn_name, fn_t, None)
}); });
println!("printf({fmt}, [{}])", args.iter().map(|arg| arg.to_string()).join(", "));
let fmt = ctx.gen_string(generator, fmt); let fmt = ctx.gen_string(generator, fmt);
let fmt = unsafe { fmt.get_field_at_index_unchecked(0) }.into_pointer_value(); let fmt = unsafe { fmt.get_field_at_index_unchecked(0) }.into_pointer_value();
@ -780,7 +782,7 @@ fn polymorphic_print<'ctx>(
let suffix = suffix.unwrap_or_default(); let suffix = suffix.unwrap_or_default();
let mut fmt = String::new(); let mut fmt = String::new();
let mut args = Vec::<BasicValueEnum<'ctx>>::new(); let mut args = Vec::new();
let flush = |ctx: &mut CodeGenContext<'ctx, '_>, let flush = |ctx: &mut CodeGenContext<'ctx, '_>,
generator: &mut dyn CodeGenerator, generator: &mut dyn CodeGenerator,