improvement

This commit is contained in:
Erin 2021-10-12 22:22:33 +02:00 committed by ondra05
parent ea79e805f2
commit cce392aaaa

View file

@ -245,9 +245,14 @@ impl ExecEnv {
} }
}, },
StmtKind::Assign { assignable, value } => { StmtKind::Assign { assignable, value } => {
// TODO: Assigning to carts
let value = self.eval_expr(value)?; let value = self.eval_expr(value)?;
self.get_var_mut(&assignable.ident)?.value.replace(value); match &assignable.kind {
crate::ast::AssignableKind::Variable => {
&self.get_var_mut(&assignable.ident)?.value
}
crate::ast::AssignableKind::Cart { indices } => todo!("assigning to carts"),
}
.replace(value);
} }
StmtKind::Break => { StmtKind::Break => {
return Ok(HaltStatus::Break(stmt.span.clone())); return Ok(HaltStatus::Break(stmt.span.clone()));