(with-slots (a b c) this
(+ a b c))
- => this.a + this.b + this.c;
+ => (this).a + (this).b + (this).c;
;;;## Regular Expression literals
;;;t \index{REGEX}
:collect nil)))
(defmethod js-to-strings ((sv js-slot-value) start-pos)
- (append-to-last (js-to-strings (sv-object sv) start-pos)
+ (append-to-last (if (typep (sv-object sv) 'js-variable)
+ (js-to-strings (sv-object sv) start-pos)
+ (list (format nil "~A" (js-to-strings (sv-object sv) start-pos))))
(if (typep (sv-slot sv) 'script-quote)
(if (symbolp (value (sv-slot sv)))
(format nil ".~A" (js-translate-symbol (value (sv-slot sv))))
(test-ps-js slot-value-setf
(setf (slot-value x 'y) (+ (+ a 3) 4))
- "x.y = (a + 3) + 4")
\ No newline at end of file
+ "x.y = (a + 3) + 4")
+
+(test-ps-js slot-value-conditional1
+ (slot-value (if zoo foo bar) 'x)
+ "(zoo ? foo : bar).x")
+
+(test-ps-js slot-value-conditional2
+ (slot-value (if (not zoo) foo bar) 'x)
+ "(!zoo ? foo : bar).x")
+
(test-ps-js object-literals-5
(with-slots (a b c) this
(+ a b c))
- "this.a + this.b + this.c;")
+ "(this).a + (this).b + (this).c;")
(test-ps-js regular-expression-literals-1
(regex "foobar")