;; A problem with long nested operator, when the statement spanned several rows
;; the rows would not be joined together correctly.
(test-ps-js bug-dwim-join
- (alert (html ((:div :id 777
- :style (css-inline :border "1pxsssssssssss"
- :font-size "x-small"
- :height (* 2 200)
- :width (* 2 300))))))
+ (alert (ps-html ((:div :id 777
+ :style (css-inline :border "1pxsssssssssss"
+ :font-size "x-small"
+ :height (* 2 200)
+ :width (* 2 300))))))
"alert('<div id=\"777\" style=\"'
+ ('border:1pxsssssssssss;font-size:x-small;height:' + 2 * 200 + ';width:'
+ 2 * 300)
(test-ps-js blank-object-literal
{}
"{ }")
+
+(test-ps-js defun-rest1
+ (defun foo (&rest bar) (alert bar[1]))
+ "function foo() {
+ var bar = [];
+ for (var _js2 = 0; _js2 < arguments.length - 0; _js2 = _js2 + 1) {
+ bar[_js2] = arguments[_js2 + 0];
+ };
+ alert(bar[1]);
+}")
+
+(test-ps-js defun-rest2
+ (defun foo (baz &rest bar) (return (+ baz (aref bar 1))))
+ "function foo(baz) {
+ var bar = [];
+ for (var _js2 = 0; _js2 < arguments.length - 1; _js2 = _js2 + 1) {
+ bar[_js2] = arguments[_js2 + 1];
+ };
+ return baz + bar[1];
+}")
+
+(test-ps-js defun-keyword1
+ (defun zoo (foo bar &key baz) (return (+ foo bar baz)))
+ "function zoo(foo, bar, _js1) {
+ _js1 = undefined === _js1 && { } || _js1;
+ return foo + bar + _js1.baz;
+}")