diff options
Diffstat (limited to 'src/eval/capture.rs')
| -rw-r--r-- | src/eval/capture.rs | 18 |
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() { |
