core/object: introduce object

A small abstraction to simplify implementations.
This commit is contained in:
lyken 2024-08-20 11:28:20 +08:00
parent 714165e00d
commit 56f44086d6
No known key found for this signature in database
GPG Key ID: 3BD5FC6AC8325DD8
3 changed files with 14 additions and 0 deletions

View File

@ -43,6 +43,7 @@ pub mod irrt;
pub mod llvm_intrinsics; pub mod llvm_intrinsics;
pub mod model; pub mod model;
pub mod numpy; pub mod numpy;
pub mod object;
pub mod stmt; pub mod stmt;
#[cfg(test)] #[cfg(test)]

View File

@ -0,0 +1,12 @@
use inkwell::values::BasicValueEnum;
use crate::typecheck::typedef::Type;
/// A NAC3 LLVM Python object of any type.
#[derive(Debug, Clone, Copy)]
pub struct AnyObject<'ctx> {
/// Typechecker type of the object.
pub ty: Type,
/// LLVM value of the object.
pub value: BasicValueEnum<'ctx>,
}

View File

@ -0,0 +1 @@
pub mod any;