2025-09-13 00:07:38 +09:00
|
|
|
use inkwell::values::{IntValue, PointerValue};
|
|
|
|
|
|
|
|
|
|
/// Lightweight newtypes for string representations used in lowering.
|
|
|
|
|
/// StrHandle crosses basic blocks; StrPtr is created at call sites within the same block.
|
|
|
|
|
pub struct StrHandle<'ctx>(pub IntValue<'ctx>);
|
|
|
|
|
pub struct StrPtr<'ctx>(pub PointerValue<'ctx>);
|
|
|
|
|
|
|
|
|
|
impl<'ctx> StrHandle<'ctx> {
|
|
|
|
|
#[inline]
|
2025-09-17 02:50:39 +09:00
|
|
|
pub fn as_i64(&self) -> IntValue<'ctx> {
|
|
|
|
|
self.0
|
|
|
|
|
}
|
2025-09-13 00:07:38 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<'ctx> From<PointerValue<'ctx>> for StrPtr<'ctx> {
|
2025-09-17 02:50:39 +09:00
|
|
|
fn from(p: PointerValue<'ctx>) -> Self {
|
|
|
|
|
Self(p)
|
|
|
|
|
}
|
2025-09-13 00:07:38 +09:00
|
|
|
}
|