feat: builtins env (WIP)
This commit is contained in:
10
src/env.rs
10
src/env.rs
@@ -8,7 +8,7 @@ use crate::{ir::Ir, ty::internal::Value};
|
||||
pub struct Env<K: Hash + Eq, V> {
|
||||
let_: Rc<LetEnv<V>>,
|
||||
with: Rc<With<K, V>>,
|
||||
args: Vec<V>,
|
||||
args: Rc<Vec<V>>,
|
||||
last: Option<Rc<Env<K, V>>>,
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ impl<K: Hash + Eq + Clone, V: Clone> Env<K, V> {
|
||||
pub fn new(map: Vec<V>) -> Rc<Self> {
|
||||
Rc::new(Self {
|
||||
let_: LetEnv::new(map),
|
||||
with: Rc::new(With {
|
||||
with: With {
|
||||
map: None,
|
||||
last: None,
|
||||
}),
|
||||
args: Vec::new(),
|
||||
}.into(),
|
||||
args: Vec::new().into(),
|
||||
last: None,
|
||||
})
|
||||
}
|
||||
@@ -70,7 +70,7 @@ impl<K: Hash + Eq + Clone, V: Clone> Env<K, V> {
|
||||
#[must_use]
|
||||
pub fn enter_arg(self: Rc<Self>, val: V) -> Rc<Self> {
|
||||
let mut args = self.args.clone();
|
||||
args.push(val);
|
||||
Rc::make_mut(&mut args).push(val);
|
||||
Rc::new(Self {
|
||||
let_: self.let_.clone(),
|
||||
with: self.with.clone(),
|
||||
|
||||
Reference in New Issue
Block a user