js-on-sx: split(undefined) returns whole string, funcexpr implicit return is undefined
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s

This commit is contained in:
2026-05-10 04:56:02 +00:00
parent df5e36aa5e
commit d7cc6d1b39
3 changed files with 15 additions and 8 deletions

View File

@@ -2969,14 +2969,19 @@
(&rest args)
(let
((sep (if (= (len args) 0) :js-undefined (nth args 0)))
(limit
(if
(< (len args) 2)
-1
(js-num-to-int (nth args 1)))))
(limit-raw (if (< (len args) 2) :js-undefined (nth args 1))))
(let
((result (js-string-split s (js-to-string sep))))
(if (< limit 0) result (js-list-take result limit))))))
((limit
(cond
((js-undefined? limit-raw) -1)
(else (js-num-to-int (js-to-number limit-raw))))))
(cond
((js-undefined? sep) (js-make-list s))
((= limit 0) (js-make-list))
(else
(let
((result (js-string-split s (js-to-string sep))))
(if (< limit 0) result (js-list-take result limit)))))))))
((= name "concat")
(fn (&rest args) (js-string-concat-loop s args 0)))
((= name "includes")

View File

@@ -1503,7 +1503,7 @@
(list
(js-sym "fn")
(list (js-sym "__return__"))
(cons (js-sym "begin") (append inits body-forms))))))
(cons (js-sym "begin") (append (append inits body-forms) (list nil)))))))
(list
(js-sym "if")
(list (js-sym "=") (js-sym "__r__") nil)