summaryrefslogtreecommitdiff
path: root/src/eval/capture.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-03-11 12:22:27 +0100
committerLaurenz <laurmaedje@gmail.com>2022-03-11 12:22:27 +0100
commit5ce2a006b6d45d29be15e4562ae3ab4fc1b8e97c (patch)
tree454b25e04530adcdf08a161e1ab09abb33c0644c /src/eval/capture.rs
parente6b532391deb1e30dc356c4d20dd48199f748f29 (diff)
Consistent block naming
Diffstat (limited to 'src/eval/capture.rs')
-rw-r--r--src/eval/capture.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/eval/capture.rs b/src/eval/capture.rs
index fd6b0101..b27aceb7 100644
--- a/src/eval/capture.rs
+++ b/src/eval/capture.rs
@@ -49,6 +49,15 @@ impl<'a> CapturesVisitor<'a> {
// through the expressions that contain them).
Some(Expr::Ident(ident)) => self.capture(ident),
+ // Blocks and templates create a scope.
+ Some(Expr::Code(_) | Expr::Template(_)) => {
+ self.internal.enter();
+ for child in node.children() {
+ self.visit(child);
+ }
+ self.internal.exit();
+ }
+
// A closure contains parameter bindings, which are bound before the
// body is evaluated. Care must be taken so that the default values
// of named parameters cannot access previous parameter bindings.
@@ -103,15 +112,6 @@ impl<'a> CapturesVisitor<'a> {
}
}
- // Blocks and templates create a scope.
- Some(Expr::Block(_) | Expr::Template(_)) => {
- self.internal.enter();
- for child in node.children() {
- self.visit(child);
- }
- self.internal.exit();
- }
-
// Everything else is traversed from left to right.
_ => {
for child in node.children() {