summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-01-23 15:02:09 +0100
committerLaurenz <laurmaedje@gmail.com>2023-01-23 15:02:09 +0100
commit84c6c8b0e6b17996a603ec88b7490107154f38f3 (patch)
tree5e32e194c81f21d1ea42c091bea6a45ea796913f /src
parent2b8426b1b3a19d46a94abaece674525948c146af (diff)
Fix closure parameter capturing
Diffstat (limited to 'src')
-rw-r--r--src/model/func.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/model/func.rs b/src/model/func.rs
index 98dc527c..73b7f1c7 100644
--- a/src/model/func.rs
+++ b/src/model/func.rs
@@ -401,6 +401,7 @@ impl<'a> CapturesVisitor<'a> {
}
}
+ self.internal.enter();
if let Some(name) = expr.name() {
self.bind(name);
}
@@ -414,6 +415,7 @@ impl<'a> CapturesVisitor<'a> {
}
self.visit(expr.body().as_untyped());
+ self.internal.exit();
}
// A let expression contains a binding, but that binding is only
@@ -513,6 +515,7 @@ mod tests {
test("{(x: y, z) => x + z}", &["y"]);
test("{(..x) => x + y}", &["y"]);
test("{(x, y: x + z) => x + y}", &["x", "z"]);
+ test("{x => x; x}", &["x"]);
// Show rule.
test("#show y: x => x", &["y"]);