Compare commits
4 Commits
a16ec23376
...
18ec4c1eac
Author | SHA1 | Date |
---|---|---|
David Mak | 18ec4c1eac | |
David Mak | cf9bfec02d | |
David Mak | fcdf0e8217 | |
David Mak | d13913d677 |
|
@ -24,7 +24,7 @@ use pyo3::{
|
|||
|
||||
use crate::{symbol_resolver::InnerResolver, timeline::TimeFns};
|
||||
|
||||
use inkwell::values::PointerValue;
|
||||
use inkwell::values::StructValue;
|
||||
use itertools::Itertools;
|
||||
use nac3core::codegen::classes::{ListValue, NDArrayValue, RangeValue, UntypedArrayLikeAccessor};
|
||||
use nac3core::codegen::expr::destructure_range;
|
||||
|
@ -748,6 +748,9 @@ fn polymorphic_print<'ctx>(
|
|||
generator: &mut dyn CodeGenerator,
|
||||
fmt: String,
|
||||
args: Vec<BasicValueEnum<'ctx>>| {
|
||||
debug_assert!(!fmt.is_empty());
|
||||
debug_assert_eq!(fmt.as_bytes().last().unwrap(), &0u8);
|
||||
|
||||
let fn_name = if as_rtio { "rtio_log" } else { "core_log" };
|
||||
let print_fn = ctx.module.get_function(fn_name).unwrap_or_else(|| {
|
||||
let llvm_pi8 = ctx.ctx.i8_type().ptr_type(AddressSpace::default());
|
||||
|
@ -780,7 +783,7 @@ fn polymorphic_print<'ctx>(
|
|||
let suffix = suffix.unwrap_or_default();
|
||||
|
||||
let mut fmt = String::new();
|
||||
let mut args = Vec::<BasicValueEnum<'ctx>>::new();
|
||||
let mut args = Vec::new();
|
||||
|
||||
let flush = |ctx: &mut CodeGenContext<'ctx, '_>,
|
||||
generator: &mut dyn CodeGenerator,
|
||||
|
@ -1087,7 +1090,7 @@ pub fn call_core_log_impl<'ctx>(
|
|||
) -> Result<(), String> {
|
||||
let (arg_ty, arg_val) = arg;
|
||||
|
||||
polymorphic_print(ctx, generator, &[(arg_ty, arg_val.into())], "", None, false, false)?;
|
||||
polymorphic_print(ctx, generator, &[(arg_ty, arg_val.into())], " ", Some("\n"), false, false)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -1096,7 +1099,7 @@ pub fn call_core_log_impl<'ctx>(
|
|||
pub fn call_rtio_log_impl<'ctx>(
|
||||
ctx: &mut CodeGenContext<'ctx, '_>,
|
||||
generator: &mut dyn CodeGenerator,
|
||||
channel: PointerValue<'ctx>,
|
||||
channel: StructValue<'ctx>,
|
||||
arg: (Type, BasicValueEnum<'ctx>),
|
||||
) -> Result<(), String> {
|
||||
let (arg_ty, arg_val) = arg;
|
||||
|
@ -1146,7 +1149,7 @@ pub fn gen_rtio_log<'ctx>(
|
|||
let channel_ty = fun.0.args[0].ty;
|
||||
assert!(ctx.unifier.unioned(channel_ty, ctx.primitives.str));
|
||||
let channel_arg =
|
||||
args[0].1.clone().to_basic_value_enum(ctx, generator, channel_ty)?.into_pointer_value();
|
||||
args[0].1.clone().to_basic_value_enum(ctx, generator, channel_ty)?.into_struct_value();
|
||||
let value_ty = fun.0.args[1].ty;
|
||||
let value_arg = args[1].1.clone().to_basic_value_enum(ctx, generator, value_ty)?;
|
||||
|
||||
|
|
Loading…
Reference in New Issue