Skip to content

Commit 4560c86

Browse files
committed
Run RHS of pattern binding with original input.
1 parent b210900 commit 4560c86

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

jaq-core/src/filter.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,10 @@ impl<F: FilterT<F>> FilterT<F> for Id {
217217
// `l as $x | r`, `l as [...] | r`, or `l as {...} | r`
218218
Ast::Pipe(l, Some(pat), r) => l.pipe(lut, cv, move |(ctx, v), y| match pat {
219219
Pattern::Var => r.run(lut, (ctx.cons_var(y), v)),
220-
Pattern::Idx(pats) => flat_map_then_with(
221-
bind_pats(pats, lut, ctx.clone(), (ctx, y.clone())),
222-
y,
223-
|ctx, y| r.run(lut, (ctx, y)),
224-
),
220+
Pattern::Idx(pats) => {
221+
let r = |ctx, v| r.run(lut, (ctx, v));
222+
flat_map_then_with(bind_pats(pats, lut, ctx.clone(), (ctx, y)), v, r)
223+
}
225224
}),
226225

227226
Ast::Comma(l, r) => Box::new(l.run(lut, cv.clone()).chain(lazy(|| r.run(lut, cv)))),

0 commit comments

Comments
 (0)