js-on-sx: new function(){}(args) parses; new with spread args works
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 42s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 42s
This commit is contained in:
@@ -153,6 +153,20 @@
|
||||
(do (jp-advance! st) (list (quote js-ident) "this")))
|
||||
((and (= (get t :type) "keyword") (= (get t :value) "new"))
|
||||
(do (jp-advance! st) (jp-parse-new-expr st)))
|
||||
((and (= (get t :type) "keyword") (= (get t :value) "function"))
|
||||
(do
|
||||
(jp-advance! st)
|
||||
(let
|
||||
((nm
|
||||
(if
|
||||
(= (get (jp-peek st) :type) "ident")
|
||||
(let ((n (get (jp-peek st) :value))) (do (jp-advance! st) n))
|
||||
nil)))
|
||||
(let
|
||||
((params (jp-parse-param-list st)))
|
||||
(let
|
||||
((body (jp-parse-block st)))
|
||||
(list (quote js-funcexpr) nm params body))))))
|
||||
((and (= (get t :type) "keyword") (= (get t :value) "true"))
|
||||
(do (jp-advance! st) (list (quote js-bool) true)))
|
||||
((and (= (get t :type) "keyword") (= (get t :value) "false"))
|
||||
|
||||
@@ -405,7 +405,19 @@
|
||||
(list
|
||||
(js-sym "js-new-call")
|
||||
(js-transpile callee)
|
||||
(cons (js-sym "js-args") (map js-transpile args)))))
|
||||
(cond
|
||||
((js-has-spread? args)
|
||||
(cons
|
||||
(js-sym "js-array-spread-build")
|
||||
(map
|
||||
(fn
|
||||
(e)
|
||||
(if
|
||||
(js-tag? e "js-spread")
|
||||
(list (js-sym "list") "js-spread" (js-transpile (nth e 1)))
|
||||
(list (js-sym "list") "js-value" (js-transpile e))))
|
||||
args)))
|
||||
(else (cons (js-sym "js-args") (map js-transpile args)))))))
|
||||
|
||||
(define
|
||||
js-transpile-array
|
||||
|
||||
Reference in New Issue
Block a user