about summary refs log blame commit diff
path: root/tvix/eval/src/value/function.rs
blob: 45efc24f09f8ad2670b11ba294fb8dad60d21c9b (plain) (tree)
1
2
3
4
5
6
7




                                                                   

                       














                                               
 




                       
//! This module implements the runtime representation of functions.
use std::rc::Rc;

use crate::chunk::Chunk;

#[derive(Clone, Debug)]
pub struct Lambda {
    // name: Option<NixString>,
    pub(crate) chunk: Rc<Chunk>,
}

impl Lambda {
    pub fn new_anonymous() -> Self {
        Lambda {
            // name: None,
            chunk: Default::default(),
        }
    }

    pub fn chunk(&mut self) -> &mut Rc<Chunk> {
        &mut self.chunk
    }
}

#[derive(Clone, Debug)]
pub struct Closure {
    pub lambda: Lambda,
}