feat: JIT (WIP)
This commit is contained in:
@@ -25,7 +25,10 @@ impl Env {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_new_cache<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> (T, HashMap<usize, Value>) {
|
||||
pub fn with_new_cache<T>(
|
||||
&mut self,
|
||||
f: impl FnOnce(&mut Self) -> T,
|
||||
) -> (T, HashMap<usize, Value>) {
|
||||
self.cache.push(HashMap::new());
|
||||
let ret = f(self);
|
||||
(ret, self.cache.pop().unwrap())
|
||||
@@ -76,7 +79,7 @@ impl Env {
|
||||
self.args[self.args.len() - level - 1].clone()
|
||||
}
|
||||
|
||||
pub fn lookup_with(&self, symbol: &EcoString) -> Option<Value> {
|
||||
pub fn lookup_with(&self, symbol: &str) -> Option<Value> {
|
||||
for with in self.with.iter().rev() {
|
||||
if let Some(ret) = with.get(symbol) {
|
||||
return Some(ret.clone());
|
||||
|
||||
Reference in New Issue
Block a user