Skip to content

Commit 7f1a814

Browse files
committed
fix(pm): keep the unwritable-form guard inert on import
`check:entry-guard` reads a top-level `for` that throws as load-time dispatch, and this file exports bindings the sibling gate imports. The same assertion is now the const initializer's own map step — a declaration, which is what the rest of this module's vocabulary already is. Claude-Session: https://claude.ai/code/session_01Gqi43smmqjJ5sUrhfoPeKu Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1d2b7ed commit 7f1a814

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

‎scripts/pm/check-widening-tells.mjs‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,16 +1523,17 @@ export const SCHEMA_PROPERTY_FORMS = Object.freeze([
15231523
* it is refused at module load rather than pinned only in the self-test: a
15241524
* malformed vocabulary must not be a gate that runs.
15251525
*/
1526-
const UNWRITABLE_FORMS = Object.freeze(SCHEMA_PROPERTY_FORMS.filter((f) => !f.writable));
1527-
for (const f of UNWRITABLE_FORMS) {
1528-
if (!f.pattern.endsWith('\\(')) {
1529-
throw new Error(
1530-
`check-widening-tells: unwritable declaring form "${f.form}" has a pattern that does not end at its open paren ` +
1531-
`(${f.pattern}) — \`declaresUnwritableKey\` locates the call's paren by the match length, so this form would ` +
1532-
`decline or fire on the wrong character. Give it a \`helper\\(\`-shaped pattern, or make it \`writable\`.`,
1533-
);
1534-
}
1526+
function closingAtItsOwnParen(f) {
1527+
if (f.pattern.endsWith('\\(')) return f;
1528+
throw new Error(
1529+
`check-widening-tells: unwritable declaring form "${f.form}" has a pattern that does not end at its open paren ` +
1530+
`(${f.pattern}) — \`declaresUnwritableKey\` locates the call's paren by the match length, so this form would ` +
1531+
`decline or fire on the wrong character. Give it a \`helper\\(\`-shaped pattern, or make it \`writable\`.`,
1532+
);
15351533
}
1534+
const UNWRITABLE_FORMS = Object.freeze(
1535+
SCHEMA_PROPERTY_FORMS.filter((f) => !f.writable).map(closingAtItsOwnParen),
1536+
);
15361537

15371538
/**
15381539
* T1 — a property whose value is a SCHEMA.

0 commit comments

Comments
 (0)