Files
scriptc/tests/corpus/primitive-and-function-descriptors.js
Chris Tate f8906d0b75 Expand static native object and array semantics (#569)
* Support primitive and function property descriptors

* Dispatch literal bracket calls to native class methods

* Handle numeric class method keys in bracket calls

* Call function values returned by class accessors

* Expand native object and array semantics

* Keep new corpus fixtures aligned with compiler gates

* Lower Object.isFrozen arguments once
2026-09-29 08:30:54 -05:00

15 lines
867 B
JavaScript

console.log(Object.getOwnPropertyDescriptor(true, 'x'));
console.log(Object.getOwnPropertyDescriptor(7, 'x'));
const text = Object.getOwnPropertyDescriptor('abc', '1');
console.log(text.value, text.writable, text.enumerable, text.configurable);
const length = Object.getOwnPropertyDescriptor('abc', 'length');
console.log(length.value, length.writable, length.enumerable, length.configurable);
function item(value) { return value; }
item[1] = 'first';
item[1] = 'second';
const own = Object.getOwnPropertyDescriptor(item, '1');
console.log(own.value, own.writable, own.enumerable, own.configurable);
Object.defineProperty(item, 'fixed', { value: 42, enumerable: false, writable: false, configurable: false });
const fixed = Object.getOwnPropertyDescriptor(item, 'fixed');
console.log(item['fixed'], fixed.value, fixed.writable, fixed.enumerable, fixed.configurable);