mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Fix closure parameter capturing
This commit is contained in:
parent
2b8426b1b3
commit
84c6c8b0e6
@ -401,6 +401,7 @@ impl<'a> CapturesVisitor<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.internal.enter();
|
||||||
if let Some(name) = expr.name() {
|
if let Some(name) = expr.name() {
|
||||||
self.bind(name);
|
self.bind(name);
|
||||||
}
|
}
|
||||||
@ -414,6 +415,7 @@ impl<'a> CapturesVisitor<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.visit(expr.body().as_untyped());
|
self.visit(expr.body().as_untyped());
|
||||||
|
self.internal.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// A let expression contains a binding, but that binding is only
|
// 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: y, z) => x + z}", &["y"]);
|
||||||
test("{(..x) => x + y}", &["y"]);
|
test("{(..x) => x + y}", &["y"]);
|
||||||
test("{(x, y: x + z) => x + y}", &["x", "z"]);
|
test("{(x, y: x + z) => x + y}", &["x", "z"]);
|
||||||
|
test("{x => x; x}", &["x"]);
|
||||||
|
|
||||||
// Show rule.
|
// Show rule.
|
||||||
test("#show y: x => x", &["y"]);
|
test("#show y: x => x", &["y"]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user