summaryrefslogtreecommitdiff
path: root/src/syntax
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-01-30 16:19:57 +0100
committerLaurenz <laurmaedje@gmail.com>2021-01-30 16:19:57 +0100
commit5943f552e512f940d4b76055d51215c23420f03a (patch)
tree0e80936f8bda91fb03076b6548bbdace707f74f5 /src/syntax
parent67047047e82c564d7701c3505c85db6e34223763 (diff)
Capture variable by slot instead of value 🎣
Diffstat (limited to 'src/syntax')
-rw-r--r--src/syntax/expr.rs10
-rw-r--r--src/syntax/visit.rs2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/syntax/expr.rs b/src/syntax/expr.rs
index 7a055cc7..ebe82199 100644
--- a/src/syntax/expr.rs
+++ b/src/syntax/expr.rs
@@ -1,6 +1,6 @@
use super::*;
use crate::color::RgbaColor;
-use crate::eval::Value;
+use crate::eval::Slot;
use crate::geom::{AngularUnit, LengthUnit};
/// An expression.
@@ -51,11 +51,11 @@ pub enum Expr {
If(ExprIf),
/// A for expression: `#for x #in y { z }`.
For(ExprFor),
- /// A captured value.
+ /// A captured variable slot.
///
/// This node is never created by parsing. It only results from an in-place
- /// transformation of an identifier to a captured value.
- CapturedValue(Value),
+ /// transformation of an identifier to a captured variable.
+ Captured(Slot),
}
impl Pretty for Expr {
@@ -88,7 +88,7 @@ impl Pretty for Expr {
Self::Let(v) => v.pretty(p),
Self::If(v) => v.pretty(p),
Self::For(v) => v.pretty(p),
- Self::CapturedValue(v) => v.pretty(p),
+ Self::Captured(v) => v.borrow().pretty(p),
}
}
}
diff --git a/src/syntax/visit.rs b/src/syntax/visit.rs
index e9e5dad7..6f0e7ef3 100644
--- a/src/syntax/visit.rs
+++ b/src/syntax/visit.rs
@@ -94,7 +94,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(v: &mut V, expr: &'a mut Expr) {
Expr::Let(e) => v.visit_let(e),
Expr::If(e) => v.visit_if(e),
Expr::For(e) => v.visit_for(e),
- Expr::CapturedValue(_) => {}
+ Expr::Captured(_) => {}
}
}