summaryrefslogtreecommitdiffstats
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
commitc15dc8fa403185f09248cc53c94ff932d9952653 (patch)
treeaf3b99dead42abfbcac0ad77fe8664a37ead7a0c
parente43223c1ce29b60178bacf4bbde68c62f5e42a94 (diff)
downloadtxr-c15dc8fa403185f09248cc53c94ff932d9952653.tar.gz
txr-c15dc8fa403185f09248cc53c94ff932d9952653.tar.bz2
txr-c15dc8fa403185f09248cc53c94ff932d9952653.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.
-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)