Files
scriptc/tests/corpus/js-object-shared-arrays.js
T
Chris Tate 05021faf2f Support three.js meshes and materials in static builds
- Compile mesh construction, transforms, cloning, and material updates for native and WASI targets.
- Preserve subclass dispatch, fluent returns, and shared array identity in JavaScript packages.
- Support native class arrays and recursive conversions without materializing classes for type checks.
2026-09-29 23:34:18 -05:00

12 lines
484 B
JavaScript

const shared = [1, 2, 3];
const a = {values: shared}, b = {nested: {values: shared}};
console.log('identity', a.values === b.nested.values, a.values === shared);
a.values[1] = 8;
console.log('write', shared[1], b.nested.values[1]);
shared.push(4);
console.log('push', a.values.length, b.nested.values.join(','));
b.nested.values.pop();
console.log('pop', shared.length, a.values.join(','));
const separate = {values: [1, 8, 3]};
console.log('distinct', separate.values === a.values);