feat: error handling
This commit is contained in:
@@ -205,7 +205,7 @@ impl Context {
|
||||
}
|
||||
let root = root.tree().expr().unwrap().downgrade(&mut self)?;
|
||||
self.resolve(root)?;
|
||||
Ok(EvalContext::eval(&mut self, root)?.to_public(&mut HashSet::new()))
|
||||
Ok(EvalContext::eval(&mut self, root)?.to_public())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,6 +361,10 @@ impl EvalContext for Context {
|
||||
self.stack.pop().unwrap()
|
||||
}
|
||||
|
||||
fn lookup_stack<'a>(&'a self, offoset: usize) -> &'a Value {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn lookup_with<'a>(&'a self, ident: &str) -> Option<&'a nixjit_eval::Value> {
|
||||
for scope in self.with_scopes.iter().rev() {
|
||||
if let Some(val) = scope.get(ident) {
|
||||
@@ -406,15 +410,6 @@ impl EvalContext for Context {
|
||||
}
|
||||
|
||||
impl JITContext for Context {
|
||||
fn lookup_arg(&self, offset: usize) -> &nixjit_eval::Value {
|
||||
let values = self.stack.last().unwrap();
|
||||
&values[values.len() - offset - 1]
|
||||
}
|
||||
|
||||
fn lookup_stack(&self, offset: usize) -> &nixjit_eval::Value {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn enter_with(&mut self, namespace: std::rc::Rc<HashMap<String, nixjit_eval::Value>>) {
|
||||
self.with_scopes.push(namespace);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user