Files
scriptc/tests/corpus/2752-array-optional-stores.ts
Chris Tate 94fd361b54 Implement sparse native arrays and missing-value parity (#297)
Represent ordinary JavaScript arrays with hole, value, and explicit-undefined states; add sparse side storage and carry missing values through the frontend, native backends, runtime, and Node-facing consumers.
2026-09-12 22:39:07 -05:00

11 lines
484 B
TypeScript

// Missing reads stored into scalar arrays use the state byte and keep the number payload ABI.
const source: number[] = [10];
const target: number[] = [1, 2];
target[0] = source[0];
target[1] = source[9];
const literal = [source[0], source[9], 30];
const hole = [, source[0], source[9]];
console.log("store", target.length, target[0], target[1]);
console.log("literal", literal.length, literal[0], literal[1], literal[2]);
console.log("hole", hole.length, hole[0], hole[1], hole[2]);