fix issue with env var to sym table sync

Signed-off-by: Ava Hahn <ava@sunnypup.io>
This commit is contained in:
Ava Apples Affine 2023-05-03 15:04:54 -07:00
parent 6d68e6f91c
commit c2cc8571bc
Signed by: affine
GPG key ID: 3A4645B8CF806069

View file

@ -56,7 +56,7 @@ pub fn eval_callback(ast: &Seg, syms: &mut SymTable) -> Result<Ctr, String> {
* kept here for reference purposes since I have gone back and forth on this
* a bit
*
* thanks you for your patience (ava)
* thank you for your patience (ava)
match arguments {
Ctr::Seg(ref s) => Ok(*eval(s, syms)?.clone()),
@ -353,7 +353,11 @@ pub fn store_callback(ast: &Seg, syms: &mut SymTable, env_cfg: bool) -> Result<C
Symbol::from_ast(&name, &docs, &outer_seg, None),
);
if env_cfg {
env::set_var(name.clone(), var_val.to_string());
let mut s = var_val.to_string();
if let Ctr::String(tok) = var_val {
s = tok;
}
env::set_var(name.clone(), s);
}
return Ok(Ctr::None)
}