stash changes before ripping up a bunch of stuff

This commit is contained in:
Scott Richmond 2024-12-11 17:37:42 -05:00
parent 7431cbf380
commit 5f154fe56f

View File

@ -3,6 +3,7 @@ use crate::parser::*;
use crate::spans::*; use crate::spans::*;
use crate::validator::FnInfo; use crate::validator::FnInfo;
use crate::value::Value; use crate::value::Value;
use chumsky::prelude::SimpleSpan;
use imbl::HashMap; use imbl::HashMap;
use imbl::Vector; use imbl::Vector;
use std::cell::RefCell; use std::cell::RefCell;
@ -35,6 +36,7 @@ pub struct Process<'src> {
pub locals: Vec<(String, Value<'src>)>, pub locals: Vec<(String, Value<'src>)>,
pub prelude: Vec<(String, Value<'src>)>, pub prelude: Vec<(String, Value<'src>)>,
pub ast: &'src Ast, pub ast: &'src Ast,
pub span: SimpleSpan,
pub fn_info: std::collections::HashMap<*const Ast, FnInfo>, pub fn_info: std::collections::HashMap<*const Ast, FnInfo>,
} }
@ -315,6 +317,11 @@ impl<'src> Process<'src> {
} }
} }
fn visit(&mut self, node: &'src Spanned<Ast>) {
self.ast = &node.0;
self.span = node.1;
}
pub fn eval(&mut self) -> LResult<'src> { pub fn eval(&mut self) -> LResult<'src> {
use Ast::*; use Ast::*;
let root = self.ast; let root = self.ast;