js-on-sx: call/apply substitute global for null/undefined this (non-strict)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 28s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 28s
This commit is contained in:
@@ -333,20 +333,25 @@
|
||||
(cond
|
||||
((= key "call")
|
||||
(let
|
||||
((this-arg (if (< (len args) 1) :js-undefined (nth args 0)))
|
||||
((raw-this (if (< (len args) 1) :js-undefined (nth args 0)))
|
||||
(rest
|
||||
(if
|
||||
(< (len args) 1)
|
||||
(list)
|
||||
(js-list-slice args 1 (len args)))))
|
||||
(js-call-with-this this-arg recv rest)))
|
||||
(let
|
||||
((this-arg
|
||||
(if (or (js-undefined? raw-this) (= raw-this nil)) js-global-this raw-this)))
|
||||
(js-call-with-this this-arg recv rest))))
|
||||
((= key "apply")
|
||||
(let
|
||||
((this-arg (if (< (len args) 1) :js-undefined (nth args 0)))
|
||||
((raw-this (if (< (len args) 1) :js-undefined (nth args 0)))
|
||||
(arr
|
||||
(if (< (len args) 2) (list) (nth args 1))))
|
||||
(let
|
||||
((rest (cond ((= arr nil) (list)) ((js-undefined? arr) (list)) ((list? arr) arr) (else (js-iterable-to-list arr)))))
|
||||
((rest (cond ((= arr nil) (list)) ((js-undefined? arr) (list)) ((list? arr) arr) (else (js-iterable-to-list arr))))
|
||||
(this-arg
|
||||
(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
|
||||
|
||||
Reference in New Issue
Block a user