diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2025-05-17 23:42:30 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2025-05-17 23:42:30 -0700 |
commit | 3bec8464a938555034ea6be43f5447a5e7409bb8 (patch) | |
tree | b15273b13706d272c45f5d71dc4c7569f37560e3 | |
parent | 606d886d0f00ec19ea19d6c04a4beca4da12248b (diff) | |
download | txr-3bec8464a938555034ea6be43f5447a5e7409bb8.tar.gz txr-3bec8464a938555034ea6be43f5447a5e7409bb8.tar.bz2 txr-3bec8464a938555034ea6be43f5447a5e7409bb8.zip |
compiler: fix unidiomatic if/cond combination.
* stdlib/compiler.tl (expand-quasi-mods): Fix unidiomatic
if form which continues with a cond fallback. All
I'm doing here is flattening (if a b (cond (c d) ...))
to (cond (a b) (c d) ...).
-rw-r--r-- | stdlib/compiler.tl | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/stdlib/compiler.tl b/stdlib/compiler.tl index 349fd9ab..bf365ff3 100644 --- a/stdlib/compiler.tl +++ b/stdlib/compiler.tl @@ -1944,19 +1944,18 @@ (when (> mcount 3) (compile-error form "too many formatting modifiers")) ^(alet ,(nreverse gens) - ,(if flex - ^(sys:fmt-flex ,obj ',plist - ,*(remq nil (list* num sep - (if scalar-ix-p - ^(rcons ,rng-ix nil) - rng-ix) - (nreverse flex)))) - (cond - (plist ^(sys:fmt-simple ,obj ,num ,sep, rng-ix ',plist)) - (rng-ix ^(sys:fmt-simple ,obj ,num ,sep, rng-ix)) - (sep ^(sys:fmt-simple ,obj ,num ,sep)) - (num ^(sys:fmt-simple ,obj ,num)) - (t ^(sys:fmt-simple ,obj ,num))))))))) + ,(cond + (flex ^(sys:fmt-flex ,obj ',plist + ,*(remq nil (list* num sep + (if scalar-ix-p + ^(rcons ,rng-ix nil) + rng-ix) + (nreverse flex))))) + (plist ^(sys:fmt-simple ,obj ,num ,sep, rng-ix ',plist)) + (rng-ix ^(sys:fmt-simple ,obj ,num ,sep, rng-ix)) + (sep ^(sys:fmt-simple ,obj ,num ,sep)) + (num ^(sys:fmt-simple ,obj ,num)) + (t ^(sys:fmt-simple ,obj ,num)))))))) (defun expand-quasi-args (form) (append-each ((el (cdr form))) |