From 6504d8c244af90fad76d101406a47a1ac4b22e22 Mon Sep 17 00:00:00 2001 From: Jonas Maier <> Date: Sat, 7 Mar 2026 12:43:38 +0100 Subject: can declare but not yet use variables --- src/main.rs | 3 +++ src/run/mod.rs | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') 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, + funs: HashMap>, /// 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) -> Result<(), ExecError> { - todo!() + self.se.lock().unwrap().funs.insert(fd.name, *fd.body.body); + Ok(()) } fn execute( -- cgit v1.2.3