js-on-sx: Function.prototype.bind throws TypeError on non-callable target
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 45s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 45s
This commit is contained in:
@@ -354,16 +354,20 @@
|
||||
(if (or (js-undefined? raw-this) (= raw-this nil)) js-global-this raw-this)))
|
||||
(js-call-with-this this-arg recv rest))))
|
||||
((= key "bind")
|
||||
(let
|
||||
((this-arg (if (< (len args) 1) :js-undefined (nth args 0)))
|
||||
(bound
|
||||
(if
|
||||
(< (len args) 1)
|
||||
(list)
|
||||
(js-list-slice args 1 (len args)))))
|
||||
(fn
|
||||
(&rest more)
|
||||
(js-call-with-this this-arg recv (js-list-concat bound more)))))
|
||||
(cond
|
||||
((not (js-function? recv))
|
||||
(raise (js-new-call TypeError (js-args "Function.prototype.bind: target is not callable"))))
|
||||
(else
|
||||
(let
|
||||
((this-arg (if (< (len args) 1) :js-undefined (nth args 0)))
|
||||
(bound
|
||||
(if
|
||||
(< (len args) 1)
|
||||
(list)
|
||||
(js-list-slice args 1 (len args)))))
|
||||
(fn
|
||||
(&rest more)
|
||||
(js-call-with-this this-arg recv (js-list-concat bound more)))))))
|
||||
((= key "toString")
|
||||
(let
|
||||
((override (js-dict-get-walk (get js-function-global "prototype") "toString")))
|
||||
|
||||
Reference in New Issue
Block a user