mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-24 06:14:01 +08:00
- The ratified rename rider (world-unification §7 lane 5): "DOM" collided with the browser DOM and, post-lane-1, the structure is no longer a document tree. Comments and doc prose now say "the checked-dynamic tree" for the noun and "dyn" adjectivally; runtime symbol names (scr_dyn_*), the error.domClone libCall, and the real web DOMException family are unchanged. - The few user-facing strings carrying the nickname move with it (the structuredClone cyclic message, the dc subscriber/publish fences, two emitter ICE texts); diagnostics snapshots regenerated (96 pass). One private compiler constant (DOM_PROTO_METHOD_NAMES -> DYN_PROTO_METHOD_NAMES) rides along. - Mechanical sweep, 142 files, comments/prose only — no behavior change.
31 lines
987 B
JavaScript
31 lines
987 B
JavaScript
// Keyed writes where the OBJECT is the dynamic thing: JSON.parse receivers
|
|
// and unknown-lowered lets take the dyn keyed write (dyn.keySet) — later
|
|
// writes win, number keys stringify (ToPropertyKey), values convert into
|
|
// the checked-dynamic tree — with dyn-keyed reads, Object.keys' own-key order (index keys
|
|
// first), a dyn MEMBER receiver, and Node's TypeErrors on non-object
|
|
// receivers (null's "Cannot set properties", the strict-mode "Cannot
|
|
// create property" on primitives).
|
|
'use strict';
|
|
const o = JSON.parse('{"a":1}');
|
|
const k = 'b' + '';
|
|
o[k] = 2;
|
|
o[k] = 3;
|
|
o['c'] = 'str';
|
|
o[7] = true;
|
|
console.log(o.a, o[k], o.c, o['7']);
|
|
console.log(Object.keys(o).join(','));
|
|
const nested = JSON.parse('{"cfg":{}}');
|
|
nested.cfg['depth' + ''] = 2;
|
|
console.log(nested.cfg.depth);
|
|
try {
|
|
JSON.parse('null')['x'] = 1;
|
|
} catch (e) {
|
|
console.log('caught:', e.message);
|
|
}
|
|
try {
|
|
JSON.parse('5')['x'] = 1;
|
|
} catch (e) {
|
|
console.log('caught:', e.message);
|
|
}
|
|
console.log('done');
|