I pushed a fix for that. Patch below.
commit 305778c609dd6102b4a313ef436985551c29ee18
Date: Fri Mar 1 17:17:04 2013 -0700
Fixed bug: multiple evaluation in WITH-SLOTS.
diff --git a/src/macros.lisp b/src/macros.lisp
index 5537872..b75f4b0 100644
--- a/src/macros.lisp
+++ b/src/macros.lisp
@@ -140,10 +140,11 @@
(if (listp slot)
(second slot)
slot)))
- `(symbol-macrolet ,(mapcar (lambda (slot)
- `(,(slot-var slot) (getprop ,object ',(slot-symbol slot))))
- slots)
- ,@body)))
+ (maybe-once-only (object)
+ `(symbol-macrolet ,(mapcar (lambda (slot)
+ `(,(slot-var slot) (getprop ,object ',(slot-symbol slot))))
+ slots)
+ ,@body))))
;;; multiple values
diff --git a/t/output-tests.lisp b/t/output-tests.lisp
index 361cd8b..f2d856c 100644
--- a/t/output-tests.lisp
+++ b/t/output-tests.lisp
@@ -141,6 +141,13 @@
(+ a b c))
"this.a + this.b + this.c;")
+(test-ps-js with-slots-single-eval
+ (lambda () (with-slots (a b) (foo) (+ a b)))
+ "(function () {
+ var object1 = foo();
+ return object1.a + object1.b;
+});")
+
(test-ps-js object-literal-quoted-symbols
(create 'test "bang" 'symbol-saved-my-life "parenscript")
"({ 'test' : 'bang', 'symbolSavedMyLife' : 'parenscript' });")