js-on-sx: js-new-call accepts list-typed constructor returns
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m1s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m1s
new Array(1,2,3) was returning an empty wrapper object because js-new-call only honoured a non-undefined return when (type-of ret) === "dict"; SX lists (representing JS arrays) were silently discarded. Widened the check to accept "list" too. Fixes new Array(1,2,3).length, String(new Array(1,2,3)), and any constructor whose body returns a list. built-ins/String: 67/99 → 69/99 (canonical). conformance.sh: 148/148.
This commit is contained in:
@@ -624,7 +624,9 @@
|
||||
(let
|
||||
((ret (js-call-with-this obj ctor args)))
|
||||
(if
|
||||
(and (not (js-undefined? ret)) (= (type-of ret) "dict"))
|
||||
(and
|
||||
(not (js-undefined? ret))
|
||||
(or (= (type-of ret) "dict") (= (type-of ret) "list")))
|
||||
ret
|
||||
obj))))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user