From 42a1f2ea0fc0080c3ff274442e5a12ad6c8c091e Mon Sep 17 00:00:00 2001 From: David Vazquez Date: Wed, 16 Jan 2013 21:01:20 +0000 Subject: [PATCH] Use special variable to fix nested toplevel compilation bug --- ecmalisp.lisp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/ecmalisp.lisp b/ecmalisp.lisp index 7b8c39f..07fe2f0 100644 --- a/ecmalisp.lisp +++ b/ecmalisp.lisp @@ -1507,19 +1507,18 @@ (compile-funcall (car sexp) (cdr sexp) env)))))) (defun ls-compile-toplevel (sexp) - (setq *toplevel-compilations* nil) - (cond - ((and (consp sexp) (eq (car sexp) 'progn)) - (let ((subs (mapcar #'ls-compile-toplevel (cdr sexp)))) - (join (remove-if #'null-or-empty-p subs)))) - (t - (let ((code (ls-compile sexp))) - (prog1 - (concat (join-trailing (get-toplevel-compilations) (concat ";" *newline*)) - (if code - (concat code ";" *newline*) - "")) - (setq *toplevel-compilations* nil)))))) + (let ((*toplevel-compilations* nil)) + (cond + ((and (consp sexp) (eq (car sexp) 'progn)) + (let ((subs (mapcar #'ls-compile-toplevel (cdr sexp)))) + (join (remove-if #'null-or-empty-p subs)))) + (t + (let ((code (ls-compile sexp))) + (concat (join-trailing (get-toplevel-compilations) + (concat ";" *newline*)) + (if code + (concat code ";" *newline*) + ""))))))) ;;; Once we have the compiler, we define the runtime environment and -- 1.7.10.4