From 3bfb836ac8dccc16eac4dbd6116535b2d50e8f2e Mon Sep 17 00:00:00 2001 From: Vladimir Sedach Date: Fri, 8 May 2009 22:54:07 -0600 Subject: [PATCH] Fixed bug where macrolet and symbol-macrolet special forms were always compiling their implicit progn bodies to statements. --- src/special-forms.lisp | 4 ++-- t/ps-tests.lisp | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/special-forms.lisp b/src/special-forms.lisp index 1125b8a..4e3acb8 100644 --- a/src/special-forms.lisp +++ b/src/special-forms.lisp @@ -414,7 +414,7 @@ lambda-list::= macro (setf (get-macro-spec name macro-env-dict) (cons nil (eval (make-ps-macro-function arglist body)))))) - (compile-parenscript-form `(progn ,@body)))) + (compile-parenscript-form `(progn ,@body) :expecting expecting))) (define-ps-special-form symbol-macrolet (symbol-macros &body body) (with-temp-macro-environment (macro-env-dict) @@ -423,7 +423,7 @@ lambda-list::= macro (setf (get-macro-spec name macro-env-dict) (cons t (lambda (x) (declare (ignore x)) expansion))))) - (compile-parenscript-form `(progn ,@body)))) + (compile-parenscript-form `(progn ,@body) :expecting expecting))) (define-ps-special-form defmacro (name args &body body) ;; should this be a macro? (eval `(defpsmacro ,name ,args ,@body)) diff --git a/t/ps-tests.lisp b/t/ps-tests.lisp index fe2898a..18e0566 100644 --- a/t/ps-tests.lisp +++ b/t/ps-tests.lisp @@ -964,4 +964,18 @@ x3 + y2;") (test-ps-js symbol-macrolet-var (symbol-macrolet ((x y)) (var x)) - "var y;") \ No newline at end of file + "var y;") + +(test-ps-js setf-conditional1 + (setf x (unless (null a) (1+ a))) + "x = a != null ? a + 1 : null;") + +(test-ps-js setf-let1 + (setf x (let ((a 1)) a)) + "x = (a1 = 1, a1);") + +(test-ps-js setf-let2 + (setf x (let ((a (foo))) + (unless (null a) + (1+ a)))) + "x = (a1 = foo(), a1 != null ? a1 + 1 : null);") -- 2.20.1