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

This commit is contained in:
2026-05-09 15:50:28 +00:00
parent 72be94c900
commit d1482482ff
3 changed files with 29 additions and 1 deletions

View File

@@ -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"))

View File

@@ -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