diff options
| -rw-r--r-- | src/main.rs | 3 | ||||
| -rw-r--r-- | src/run/mod.rs | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 925c62c..1dd86bc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,6 +25,7 @@ use linebuf::LineBuf; use raw::*; use crate::cursor::{Direction, move_cursor}; +use crate::parse::{Ast, PreExpansion}; use crate::run::CommandDispatch; macro_rules! print { @@ -64,6 +65,7 @@ pub struct Session { dispatch: CommandDispatch, prev_path: BString, vars: HashMap<BString, BString>, + funs: HashMap<BString, Ast<PreExpansion>>, /// n before end of history.len() /// 0 == not checking history @@ -205,6 +207,7 @@ fn event_loop() { prev_path: vec![b'.'], history_visit: 0, vars: HashMap::new(), + funs: HashMap::new(), }; print!("{}", se.prompt()); diff --git a/src/run/mod.rs b/src/run/mod.rs index db0ed05..4970792 100644 --- a/src/run/mod.rs +++ b/src/run/mod.rs @@ -208,7 +208,8 @@ impl Executor { } fn execute_fun_decl(&mut self, fd: parse::FunDecl<PostExpansion>) -> Result<(), ExecError> { - todo!() + self.se.lock().unwrap().funs.insert(fd.name, *fd.body.body); + Ok(()) } fn execute( |
