summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-05-23 21:44:10 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-05-23 21:44:10 -0700
commitd57e7d2d686ebd0629a4ca3167acad10f203227f (patch)
tree4973a7ef3f666c89deb0c9c198fe994db4c4df20
parentecbe8288afad8b2e181b50a69ca6920426f38824 (diff)
downloadtxr-d57e7d2d686ebd0629a4ca3167acad10f203227f.tar.gz
txr-d57e7d2d686ebd0629a4ca3167acad10f203227f.tar.bz2
txr-d57e7d2d686ebd0629a4ca3167acad10f203227f.zip
awk: bug: broken redirection operators.
* stdlib/awk.tl (sys:awk-redir): Fix regression from April 2018. The gensym variable introduced must be parallel bound, since it is referenced by the init expression of the other variable. This breaks all awk redirection operators.
-rw-r--r--stdlib/awk.tl4
1 files changed, 2 insertions, 2 deletions
diff --git a/stdlib/awk.tl b/stdlib/awk.tl
index 54d2909c..d82ab8c3 100644
--- a/stdlib/awk.tl
+++ b/stdlib/awk.tl
@@ -289,8 +289,8 @@
(defmacro sys:awk-redir (aws-sym stream-var kind mode path body)
(with-gensyms (res-sym)
- ^(let ((,res-sym ,path)
- (,stream-var (qref ,aws-sym (ensure-stream ,kind ,res-sym ,mode))))
+ ^(let* ((,res-sym ,path)
+ (,stream-var (qref ,aws-sym (ensure-stream ,kind ,res-sym ,mode))))
,(if body
^(qref ,aws-sym (close-or-flush ,stream-var ,kind ,res-sym
(progn ,*body)))