Fixed type bug with printing slot-value with obj/slot being a non-list.
authorVladimir Sedach <vsedach@gmail.com>
Sun, 12 Aug 2007 16:56:22 +0000 (16:56 +0000)
committerVladimir Sedach <vsedach@gmail.com>
Sun, 12 Aug 2007 16:56:22 +0000 (16:56 +0000)
src/js-translation.lisp
t/ps-tests.lisp

index b160690..b4aacd0 100644 (file)
@@ -379,10 +379,10 @@ vice-versa.")
               :collect nil)))
 
 (defprinter js-slot-value (obj slot)
-  (append-to-last (if (eql 'js-variable (car obj))
+  (append-to-last (if (and (listp obj) (eql 'js-variable (car obj)))
                       (ps-print obj %start-pos%)
                       (list (format nil "~A" (ps-print obj %start-pos%))))
-                  (if (eql 'script-quote (car slot))
+                  (if (and (listp slot) (eql 'script-quote (car slot)))
                       (format nil ".~A" (if (symbolp (second slot))
                                             (js-translate-symbol (second slot))
                                             (first (ps-print slot 0))))
index d35d155..2ad1646 100644 (file)
@@ -285,4 +285,8 @@ x = 2 + sideEffect() + x + 5;")
 
 (test-ps-js obj-literal-strings
   (create "foo" 2)
-  "{ 'foo' : 2 }")
\ No newline at end of file
+  "{ 'foo' : 2 }")
+
+(test-ps-js slot-value-string
+  (slot-value foo "bar")
+  "foo['bar']")