From eb10286190b64ecbcf023760ce01f1a8ce77ac86 Mon Sep 17 00:00:00 2001
From: Kaz Kylheku <kaz@kylheku.com>
Date: Wed, 4 Apr 2018 06:55:36 -0700
Subject: compile-file: don't compile constants.

* share/txr/stdlib/compiler.tl: Skip top-level forms which are
just constants. Their value is discarded and they have no
effect.
---
 share/txr/stdlib/compiler.tl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'share')

diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index a5fd9e0d..e56287c7 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -1372,7 +1372,8 @@
                                      [mapdo compile-form (cdr form)]))
                      (eval-only (let ((*emit* nil))
                                   [mapdo compile-form (cdr form)]))
-                     (t (when (or *eval* *emit*)
+                     (t (when (and (or *eval* *emit*)
+                                   (not (constantp form)))
                           (let* ((vm-desc (compile-toplevel form))
                                  (flat-vd (list-from-vm-desc vm-desc)))
                             (when *eval*
-- 
cgit v1.2.3