Commit 49c50da4 authored by Vladimir Sedach's avatar Vladimir Sedach
Browse files

Fixed problem with (- 1). Unary operator "-" didn't like number constants.

parent a2a9eab0
......@@ -971,7 +971,7 @@ a-variable => aVariable
; (DEFPSMACRO name lambda-list macro-body)
; (MACROLET ({name lambda-list macro-body}*) body)
; (SYMBOL-MACROLET ({name macro-body}*) body)
; (PS-GENSYM {string}?)
; (PS-GENSYM {string})
;
; name ::= a Lisp symbol
; lambda-list ::= a lambda list
......
......@@ -199,7 +199,7 @@ vice-versa.")
(defprinter unary-operator (op arg &key prefix)
(when prefix
(write-string op))
(if (eql 'operator (car arg))
(if (and (listp arg) (eql 'operator (car arg)))
(parenthesize-print arg)
(ps-print arg))
(unless prefix
......
......@@ -275,6 +275,14 @@ x = 2 + sideEffect() + x + 5;")
(decf foo bar)
"foo -= bar")
(test-ps-js incf2
(incf x 5)
"x += 5")
(test-ps-js decf2
(decf y 10)
"y -= 10")
(test-ps-js setf-conditional
(setf foo (if x 1 2))
"foo = x ? 1 : 2;")
......@@ -389,3 +397,7 @@ x = 2 + sideEffect() + x + 5;")
img))
img))
"document.write(LINKORNOT == 1 ? '<a href=\"#\" onclick=\"' + 'javascript:transport();' + '\">' + img + '</a>' : img)")
(test-ps-js negate-number-literal ;; ok, this was broken and fixed before, but no one bothered to add the test!
(- 1)
"-1")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment