/** * One Web module analyzed end to end: the tables the whole-program rules are * read out of, the two refusals that are decided before the core walk starts, * and the three reports that can only be written once it has ended. * * D115 P4 R3c. The sequence is one function because the *order* is the rule — * the Look and reactive tables have to exist before any statement is walked, the * two module-level refusals land at their declarations rather than at a later * use, and each closing report needs the whole module's evidence. The core walk * itself stays on the analyzer, which is the only thing that can reach it, and * arrives here as `analyzeCore`. */ import { type Diagnostic } from "@velarscript/compiler"; import { type Program } from "@velarscript/compiler/extension"; import { type LookStaticScope, type LookStaticValue } from "../look-static.ts"; import { type WebJsxAttribute as JSXAttribute, type WebJsxElementExpression as JSXElementExpression, type WebLookExpression } from "../ast.ts"; import { type FunctionDeclarationStatement, type KeyedRebuildHost } from "./keyed-rebuild.ts"; import { type LookImportSite } from "./look-sites.ts"; import { type RetiredAccessorHost } from "./reactivity/retired-accessors.ts"; import { type ReactiveWriterDeclaration } from "./watch-cycles.ts"; /** * The module-wide tables this pass fills, and the two module readings the * before-and-after refusals need. Every table is written here and read by a * collaborator that declares it `readonly`, which is why they are accessor * pairs on the analyzer rather than plain fields on the host. */ export interface ProgramTableHost { /** Every name in this module whose read is reactive without the binding being a state/prop reference. */ readonly derivedReactiveNames: Set; /** The `velar/look` values this module imported, which seed the compile-time Look scope. */ readonly importedLookStaticValues: ReadonlyMap; /** D89 A4: the binding identity of every list a keyed `.map(...)` interpolation renders. */ readonly keyedListSources: Set; /** D57 rule 138: `velar/web-test` is legal only where the browser runner looks. */ readonly webModulePath: string | null; /** The elements whose `key` the keyed fast path will actually read. */ readonly honoredJsxKeys: ReadonlySet; /** Elements already answered for an ineffective key, so this pass does not repeat one. */ readonly reportedJsxKeys: ReadonlySet; /** Every `key` written on a statically placed element, judged once the walk has ended. */ readonly staticJsxKeys: readonly { readonly element: JSXElementExpression; readonly attribute: JSXAttribute; }[]; lookBuilderNames: ReadonlyMap; lookDeclarations: ReadonlyMap; lookImport: LookImportSite | null; lookStatic: LookStaticScope; moduleFunctions: ReadonlyMap; publicConfigNames: ReadonlySet; reactiveDerivations: ReadonlyMap | null>; reactiveStateNames: ReadonlyMap; reactiveWriters: ReadonlyMap; readonly diagnostics: Diagnostic[]; markTypeNameRefused(name: string): void; } /** * What the program passes ask of the analyzer that hosts them: the tables above, * plus everything the two closing reports need — the keyed-rebuild advisory and * the retired-accessor migration are the last two passes, so this face really * does contain theirs. */ export type ProgramPassHost = ProgramTableHost & KeyedRebuildHost & RetiredAccessorHost; export declare function analyzeWebProgram(host: ProgramPassHost, program: Program, analyzeCore: (program: Program) => void): readonly Diagnostic[]; /** * D57 rule 138: `velar/web-test` only has a runtime under `velar test * --browser`, so an import of it anywhere else compiles a call that cannot * succeed. D51 rule 109 puts the refusal at the declaration rather than at the * eventual use, so the error lands on the `import` line — including the * JavaScript-bridge and re-export spellings, which reach the same runtime. */ export declare function reportBrowserTestImports(host: ProgramPassHost, program: Program): void; /** * D72 rule 186: a Web module publishes its own type names, and a user * declaration of one used to be accepted at the declaration and then lose at * every use — `type Event:` compiled, and `describe({kind: "charge"})` was * told it could not assign to `Event`, naming a type the author had just * written. D51 rule 109 already settled where that refusal belongs: at the * declaration, which is the only place a rename is cheap. * * The names come from the extension's own published table, so adding a type * to `WEB_OWNED_TYPE_NAMES` extends this protection with it. The last time * this family was repaired by listing names instead of deriving them, the * list drifted; D57 rule 135 is the same repair on the Core roster. * * Core now says the same sentence about its own built-in type names — * `builtinTypeNameDeclarationMessage` in packages/compiler/src/analyzer.ts, * reported as VEL3007. The rosters differ; the wording is meant to read * alike, so a change to either sentence belongs in both. * * `Duration` is on both rosters — Core owns it as a primitive and * `velar/look` republishes it — so a Web module used to report it twice. This * refusal is the more specific of the two, because it names the surface the * author is writing against, so it marks the name refused and Core's stays * unsaid. The mark is Core's own hook, which is what lets this pass take * precedence without either side learning the other's roster. */ export declare function rejectWebOwnedTypeNames(host: ProgramPassHost, program: Program): void; /** * WEB-C1: charter §14 promises that a key outside a keyed shape is a * diagnostic rather than a silent no-op. Interpolated positions report while * their interpolation is walked; static positions are collected during JSX * inference and reported once every keyed interpolation is known. */ export declare function reportStaticJsxKeys(host: ProgramPassHost): void; //# sourceMappingURL=program-passes.d.ts.map