Files
scriptc/tests/corpus/destructure-call-assignment.js
Chris Tate bf21f47827 Compile collection metadata and heterogeneous JavaScript tables natively
- Preserve async factory results and mixed table layouts through inference and destructuring.
- Support checked Map and Object.fromEntries construction with native weak collections.
- Keep native weak-key lifetimes and engine-backed collection identities intact.
2026-09-28 22:20:24 -05:00

15 lines
614 B
JavaScript

let calls = 0;
let x;
let y;
function make(value) { calls++; return value; }
const source = { nested: { make } };
const record = { x: 3, y: 7 };
const result = ({ x, y } = make(record));
console.log(calls, x, y, result === record);
({ x, y } = source.nested.make({ x: 11, y: 13 }));
console.log(calls, x, y);
try { ({ x } = make(null)); } catch (error) { console.log(error.name, error.message); }
try { ({ x } = source.nested.make(undefined)); } catch (error) { console.log(error.name, error.message); }
try { ({} = make(undefined)); } catch (error) { console.log(error.name, error.message); }
console.log(calls);