summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-12-01 06:40:17 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-12-01 06:40:17 -0800
commit203b85801e0bade02af3b9e09205041e97771799 (patch)
treeaf3b99dead42abfbcac0ad77fe8664a37ead7a0c /share
parentba858aeab76824d84eca2a0f183ca865eae8b4d6 (diff)
downloadtxr-203b85801e0bade02af3b9e09205041e97771799.tar.gz
txr-203b85801e0bade02af3b9e09205041e97771799.tar.bz2
txr-203b85801e0bade02af3b9e09205041e97771799.zip
bugfix: previous loop elision fix in awk.
* share/txr/stdlib/awk.tl (awk): We must generate the code to bind the awk-fun under the same conditions that control whether the loop call is generated to which it is an argument. Otherwise we end up with an unbound var reference: the loop isn't elided because begin/end actions are present, but the call refers to a nonexistent variable.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/awk.tl3
1 files changed, 2 insertions, 1 deletions
diff --git a/share/txr/stdlib/awk.tl b/share/txr/stdlib/awk.tl
index a2fa0785..d36426f3 100644
--- a/share/txr/stdlib/awk.tl
+++ b/share/txr/stdlib/awk.tl
@@ -321,7 +321,8 @@
,*(if (and awc.cond-actions awc.end-file-actions)
^((,awk-endf-fun (lambda (,aws-sym)
,*awc.end-file-actions))))
- ,*(if awc.cond-actions
+ ,*(if (or awc.cond-actions awc.begin-file-actions
+ awc.end-file-actions awc.end-actions)
^((,awk-fun (lambda (,aws-sym)
,(if awc.rng-exprs
^(let* ((,awc.rng-rec-temp rec)