feat: error handling

This commit is contained in:
2025-08-08 19:35:51 +08:00
parent a9cfddbf5c
commit fd182b6233
12 changed files with 187 additions and 311 deletions

View File

@@ -32,13 +32,8 @@ use helpers::*;
/// A trait that provides the execution context for JIT-compiled code.
///
/// This trait extends `EvalContext` with additional methods needed
/// for JIT compilation, such as stack and argument lookups, and
/// managing `with` expression scopes.
/// for JIT compilation, such as managing `with` expression scopes directly.
pub trait JITContext: EvalContext {
/// Looks up a value in the evaluation stack by offset.
fn lookup_stack(&self, offset: usize) -> &Value;
/// Looks up a function argument by offset.
fn lookup_arg(&self, offset: usize) -> &Value;
/// Enters a `with` expression scope with the given namespace.
fn enter_with(&mut self, namespace: Rc<HashMap<String, Value>>);
/// Exits the current `with` expression scope.