diff --git a/src/evaluate/evaluate.rs b/src/evaluate/evaluate.rs index c70a086..9544ed2 100644 --- a/src/evaluate/evaluate.rs +++ b/src/evaluate/evaluate.rs @@ -46,7 +46,10 @@ pub fn evaluate(t: &Expression, context: &mut Context) -> Result { Some(evaluate(&c.value(), context).unwrap()) }, Expression::Variable(l, s) => { - move_up = false; // Don't move up, re-evaluate + // Don't move up, re-evaluate + // This makes variables containing floating variables work properly + // (For example, try x = a + 2, a = 2, x. x should evaluate to 4.) + move_up = false; let v = context.get_variable(&s); // Error if variable is undefined.