chore: comment

This commit is contained in:
2025-08-07 21:00:32 +08:00
parent f946cb2fd1
commit 67cdcfea33
24 changed files with 734 additions and 105 deletions

View File

@@ -1,3 +1,5 @@
//! Defines the runtime representation of a partially applied primitive operation.
use std::rc::Rc;
use derive_more::Constructor;
@@ -8,15 +10,28 @@ use nixjit_ir::PrimOpId;
use super::Value;
use crate::EvalContext;
/// Represents a partially applied primitive operation (builtin function).
///
/// This struct holds the state of a primop that has received some, but not
/// all, of its required arguments.
#[derive(Debug, Clone, Constructor)]
pub struct PrimOpApp {
/// The name of the primitive operation.
pub name: &'static str,
/// The number of remaining arguments the primop expects.
arity: usize,
/// The unique ID of the primop.
id: PrimOpId,
/// The arguments that have already been applied.
args: Vec<Value>,
}
impl PrimOpApp {
/// Applies more arguments to a partially applied primop.
///
/// If enough arguments are provided to satisfy the primop's arity, it is
/// executed. Otherwise, it returns a new `PrimOpApp` with the combined
/// arguments.
pub fn call(
self: &mut Rc<Self>,
args: Vec<Value>,