Commit 06ed0d3a authored by Vladimir Sedach's avatar Vladimir Sedach
Browse files

Added Daniel Gackle <danielgackle@gmail.com>'s contributed [] (nested) array...

Added Daniel Gackle <danielgackle@gmail.com>'s contributed [] (nested) array literal macro to the macro library.
parent af344c9b
......@@ -54,6 +54,13 @@
;;; Data structures
(defpsmacro [] (&rest args)
`(array ,@(mapcar (lambda (arg)
(if (and (consp arg) (not (equal '[] (car arg))))
(cons '[] arg)
arg))
args)))
(defpsmacro length (a)
`(@ ,a length))
......
......@@ -21,6 +21,7 @@
#:list
#:aref
#:make-array
#:[]
;; operators
#:! #:not #:~
......
......@@ -332,6 +332,26 @@ x = 2 + sideEffect() + x + 5;")
({} a 1 b 2)
"{a: 1, b: 2 }")
(test-ps-js array-literal1
[]
"[]")
(test-ps-js array-literal2
([])
"[]")
(test-ps-js array-literal3
([] 1 2 3)
"[1, 2, 3]")
(test-ps-js array-literal4
([] 1 (2 3))
"[1, [2, 3]]")
(test-ps-js array-literal5
([] (1 2) ("a" "b"))
"[[1, 2], ['a', 'b']]")
(test-ps-js defun-rest1
(defun foo (&rest bar) (alert bar[1]))
"function foo() {
......
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