js-on-sx: Object is callable (new Object, Object(x))

Adds __callable__ to the Object global dict: zero args returns {}, one-arg
returns the arg (which mirrors spec ToObject for non-null/undefined). This
unblocks many test262 tests that write 'new Object(true)' or 'Object(5)'
— they were failing with 'Not callable: {:entries ...}' because Object
was a plain dict with no call protocol.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-24 09:19:11 +00:00
parent 85a329e8d6
commit 9ea67b9422

View File

@@ -2567,7 +2567,7 @@
(and (>= idx 0) (< idx (len o)) (integer? idx))))
(else false))))
(define Object {:entries js-object-entries :defineProperties js-object-define-properties :preventExtensions js-object-prevent-extensions :prototype {} :values js-object-values :hasOwn js-object-has-own :freeze js-object-freeze :assign js-object-assign :isFrozen js-object-is-frozen :getOwnPropertyDescriptor js-object-get-own-property-descriptor :fromEntries js-object-from-entries :defineProperty js-object-define-property :setPrototypeOf js-object-set-prototype-of :getOwnPropertyNames js-object-get-own-property-names :getOwnPropertyDescriptors js-object-get-own-property-descriptors :create js-object-create :isExtensible js-object-is-extensible :is js-object-is :keys js-object-keys :getPrototypeOf js-object-get-prototype-of :isSealed js-object-is-sealed :seal js-object-seal})
(define Object {:entries js-object-entries :defineProperties js-object-define-properties :__callable__ (fn (&rest args) (cond ((= (len args) 0) (dict)) (else (nth args 0)))) :preventExtensions js-object-prevent-extensions :prototype {} :values js-object-values :hasOwn js-object-has-own :freeze js-object-freeze :assign js-object-assign :isFrozen js-object-is-frozen :getOwnPropertyDescriptor js-object-get-own-property-descriptor :fromEntries js-object-from-entries :defineProperty js-object-define-property :setPrototypeOf js-object-set-prototype-of :getOwnPropertyNames js-object-get-own-property-names :getOwnPropertyDescriptors js-object-get-own-property-descriptors :create js-object-create :isExtensible js-object-is-extensible :is js-object-is :keys js-object-keys :getPrototypeOf js-object-get-prototype-of :isSealed js-object-is-sealed :seal js-object-seal})
(define
js-delete-prop