I have also encountered this problem. Enclosed is a patch, with an additional fix to a similar issues inside arefs/arrays.
I hope the patches are acceptable (don't know git well enough). I would prefer for them to not depend on my other patches from a few days ago. Will they still merge ok? Yong. On 5/4/10, Daniel Gackle <[email protected]> wrote: > Another syntax error in the new PS. This form: > > (let ((blah (let ((x (foo))) > (if (null x) y z))))) > > ... compiles to... > > var blah = x = foo(), x == null ? y : z; > > ... which is incorrect. Previously, PS produced this, which is correct: > > var blah = (x = foo(), x == null ? y : z); > > Daniel >
From 537788dbecc93ab17b78cd0ce0b24c6d540b11f8 Mon Sep 17 00:00:00 2001 From: Chew Theam Yong <[email protected]> Date: Fri, 14 May 2010 20:42:41 +1200 Subject: [PATCH] Operator precedence - fixed handling of nested lets. --- src/printer.lisp | 2 +- t/ps-tests.lisp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/printer.lisp b/src/printer.lisp index 8e1524d..811ded7 100644 --- a/src/printer.lisp +++ b/src/printer.lisp @@ -245,7 +245,7 @@ vice-versa.") (defprinter js:var (var-name &rest var-value) "var "(psw (symbol-to-js-string var-name)) (when var-value - (psw " = ") (ps-print (car var-value)))) + (psw " = ") (print-op-argument 'js:= (car var-value)))) (defprinter js:label (label statement) (psw (symbol-to-js-string label))": "(ps-print statement)) diff --git a/t/ps-tests.lisp b/t/ps-tests.lisp index 0c529d4..3f07c2b 100644 --- a/t/ps-tests.lisp +++ b/t/ps-tests.lisp @@ -1699,3 +1699,7 @@ x();") (+ (/ 1 (/ 2 3)) (- 1 (- 2 3))) "1 / (2 / 3) + 1 - (2 - 3);") +(test-ps-js operator-expressions-nested-let + (let ((x (let ((y 1)) y))) x) + "var x = (y = 1, y); x;") + -- 1.6.0.4
From 98b786648c52972d3f0db638e6de5cb0431777b8 Mon Sep 17 00:00:00 2001 From: Chew Theam Yong <[email protected]> Date: Fri, 14 May 2010 20:44:15 +1200 Subject: [PATCH] Operator precedence - fixed parenthesizing for comma in arrays. --- src/printer.lisp | 3 ++- t/ps-tests.lisp | 3 +++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/printer.lisp b/src/printer.lisp index 811ded7..072da97 100644 --- a/src/printer.lisp +++ b/src/printer.lisp @@ -180,7 +180,8 @@ vice-versa.") (defun print-comma-delimited-list (ps-forms) (loop for (form . remaining) on ps-forms do - (ps-print form) (when remaining (psw ", ")))) + (print-op-argument 'js:|,| form) + (when remaining (psw ", ")))) (defprinter js:array (&rest initial-contents) "["(print-comma-delimited-list initial-contents)"]") diff --git a/t/ps-tests.lisp b/t/ps-tests.lisp index 3f07c2b..f49ab1f 100644 --- a/t/ps-tests.lisp +++ b/t/ps-tests.lisp @@ -1703,3 +1703,6 @@ x();") (let ((x (let ((y 1)) y))) x) "var x = (y = 1, y); x;") +(test-ps-js operator-expressions-array-nested-let + (list (let ((y 1)) y) 2) + "[(y = 1, y), 2];") -- 1.6.0.4
_______________________________________________ parenscript-devel mailing list [email protected] http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
