mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-17 05:09:24 +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.
34 lines
898 B
JavaScript
34 lines
898 B
JavaScript
// The evolving-array declaration idiom (test/common's leakedGlobals
|
|
// ledger): a JS `const leaked = []` types by its LATER pushes, so the
|
|
// binding rides the checked-dynamic array — pushes land in the checked-dynamic tree,
|
|
// typed exits validate back out, and the function's evolved return type
|
|
// agrees with what callers read.
|
|
'use strict';
|
|
function collect() {
|
|
const leaked = [];
|
|
for (const v of ['alpha', 'beta', 'gamma']) {
|
|
if (v !== 'beta') {
|
|
leaked.push(v);
|
|
}
|
|
}
|
|
return leaked;
|
|
}
|
|
const out = collect();
|
|
console.log(out.length);
|
|
console.log(out.join(', '));
|
|
console.log(out.length > 0 ? 'leaked' : 'clean');
|
|
|
|
// The number flavor, and an empty-forever ledger.
|
|
function nums() {
|
|
const acc = [];
|
|
acc.push(1);
|
|
acc.push(2);
|
|
return acc;
|
|
}
|
|
console.log(JSON.stringify(nums()));
|
|
function never() {
|
|
const empty = [];
|
|
return empty;
|
|
}
|
|
console.log(never().length);
|