Fixed bug where macrolet and symbol-macrolet special forms were always
authorVladimir Sedach <vsedach@gmail.com>
Sat, 9 May 2009 04:54:07 +0000 (22:54 -0600)
committerVladimir Sedach <vsedach@gmail.com>
Sat, 9 May 2009 04:54:07 +0000 (22:54 -0600)
compiling their implicit progn bodies to statements.

src/special-forms.lisp
t/ps-tests.lisp

index 1125b8a..4e3acb8 100644 (file)
@@ -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))
index fe2898a..18e0566 100644 (file)
@@ -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);")