summaryrefslogtreecommitdiff
path: root/src/eval/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-01-27 11:50:51 +0100
committerLaurenz <laurmaedje@gmail.com>2021-01-27 11:50:51 +0100
commitce8138c68557a2d158424a8aa6056d73ff9cb1ba (patch)
treea90616fc9194a6814e9a36493e38c6efb65af7e3 /src/eval/mod.rs
parent710f88ccb2bceb9851a8fb0b7f131343ee33dbd5 (diff)
Scope variables in blocks 🏔️
Diffstat (limited to 'src/eval/mod.rs')
-rw-r--r--src/eval/mod.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/eval/mod.rs b/src/eval/mod.rs
index e04879d2..cadffef5 100644
--- a/src/eval/mod.rs
+++ b/src/eval/mod.rs
@@ -210,10 +210,19 @@ impl Eval for Spanned<&ExprBlock> {
type Output = Value;
fn eval(self, ctx: &mut EvalContext) -> Self::Output {
+ if self.v.scopes {
+ ctx.scopes.push();
+ }
+
let mut output = Value::None;
for expr in &self.v.exprs {
output = expr.eval(ctx);
}
+
+ if self.v.scopes {
+ ctx.scopes.pop();
+ }
+
output
}
}