js-on-sx: Boolean.prototype.toString/valueOf throw TypeError on non-Boolean
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
This commit is contained in:
@@ -4562,12 +4562,13 @@
|
||||
(&rest args)
|
||||
(let
|
||||
((this-val (js-this)))
|
||||
(if
|
||||
(and
|
||||
(= (type-of this-val) "dict")
|
||||
(contains? (keys this-val) "__js_boolean_value__"))
|
||||
(get this-val "__js_boolean_value__")
|
||||
this-val))))
|
||||
(cond
|
||||
((= (type-of this-val) "boolean") this-val)
|
||||
((and
|
||||
(= (type-of this-val) "dict")
|
||||
(contains? (keys this-val) "__js_boolean_value__"))
|
||||
(get this-val "__js_boolean_value__"))
|
||||
(else (raise (js-new-call TypeError (js-args "Boolean.prototype.valueOf requires a Boolean"))))))))
|
||||
|
||||
(dict-set!
|
||||
(get Boolean "prototype")
|
||||
@@ -4576,9 +4577,11 @@
|
||||
(&rest args)
|
||||
(let
|
||||
((this-val (js-this)))
|
||||
(let
|
||||
((b (if (and (= (type-of this-val) "dict") (contains? (keys this-val) "__js_boolean_value__")) (get this-val "__js_boolean_value__") this-val)))
|
||||
(if b "true" "false")))))
|
||||
(cond
|
||||
((= (type-of this-val) "boolean") (if this-val "true" "false"))
|
||||
((and (= (type-of this-val) "dict") (contains? (keys this-val) "__js_boolean_value__"))
|
||||
(if (get this-val "__js_boolean_value__") "true" "false"))
|
||||
(else (raise (js-new-call TypeError (js-args "Boolean.prototype.toString requires a Boolean"))))))))
|
||||
|
||||
(define
|
||||
parseInt
|
||||
|
||||
Reference in New Issue
Block a user