mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +08:00
* 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
15 lines
867 B
JavaScript
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);
|