Fixed AREF when an expression is passed as the array.
authorTravis Cross <tc@traviscross.com>
Fri, 22 Aug 2008 07:07:07 +0000 (07:07 +0000)
committerTravis Cross <tc@traviscross.com>
Fri, 22 Aug 2008 07:07:07 +0000 (07:07 +0000)
(aref (or a b c) 0) now works.

Thanks to Daniel Gackle for the bug report.

src/printer.lisp

index 9ab4e28..7f57aea 100644 (file)
@@ -144,7 +144,9 @@ vice-versa.")
   (psw #\[) (print-comma-delimited-list initial-contents) (psw #\]))
 
 (defprinter js-aref (array indices)
-  (ps-print array)
+  (if (>= (expression-precedence array) #.(expression-precedence '(operator js-aref)))
+      (parenthesize-print array)
+      (ps-print array))
   (loop for idx in indices do
         (psw #\[) (ps-print idx) (psw #\])))