mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +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.
42 lines
944 B
JavaScript
42 lines
944 B
JavaScript
// JS catch variables under useUnknownInCatchVariables: a JS catch clause
|
|
// cannot annotate its variable, so the "'e' is of type 'unknown'" demand
|
|
// joins the JS relaxation — the value stays unknown and rides the
|
|
// checked-dynamic tree at its uses (member reads, String()), the suite's
|
|
// dominant catch shape (assert error-path tests).
|
|
'use strict';
|
|
|
|
try {
|
|
throw new Error('boom');
|
|
} catch (e) {
|
|
console.log(e.message);
|
|
console.log(e.name);
|
|
console.log(String(e));
|
|
}
|
|
|
|
function thrower(kind) {
|
|
if (kind === 'type') {
|
|
throw new TypeError('wrong kind');
|
|
}
|
|
throw new RangeError('out of range');
|
|
}
|
|
|
|
try {
|
|
thrower('type');
|
|
} catch (err) {
|
|
console.log(err.name);
|
|
console.log(typeof err.message);
|
|
}
|
|
|
|
try {
|
|
thrower('range');
|
|
} catch (err) {
|
|
console.log(`${err.name}: ${err.message}`);
|
|
}
|
|
|
|
// Non-Error throws land as their own values, like Node.
|
|
try {
|
|
throw 'plain string';
|
|
} catch (e) {
|
|
console.log(typeof e, e);
|
|
}
|