/** * What the Web extension adds to expression inference, either side of the core * walk: the shapes it refuses before the core sees them, the answers it has * already computed and hands back instead of walking again, the Look length a * builder call folds to, and the two reports a call earns once its type is * known. The extension's own call and type-syntax rules — a component element * called like a function, and `Component` — are here too. * * D115 P4 R3c. The dispatch itself stays on the analyzer: `inferExpression` and * `inferExtensionExpression` are seams the core owns, and what they hand to the * JSX, keyframes and Look walks is the one thing that is genuinely a dispatch. * Everything on either side of it is a rule, and rules live here. */ import { type Span } from "@velarscript/compiler"; import { type Expression, type ExtensionValueType, type TypeReference, type TypeSyntax, type ValueType } from "@velarscript/compiler/extension"; import { type LookAnalysisHost } from "./look/host.ts"; import { type ReactiveNamesHost } from "./reactivity/host.ts"; import { type RetiredAccessorHost } from "./reactivity/retired-accessors.ts"; /** The state the inference rules own: the probe cache, and the two module inputs a call is proved against. */ export interface ExpressionInferenceHost { constantValue(expression: Expression): string | number | boolean | null | undefined; importedMemberOf(name: string): { readonly source: string; readonly imported: string | null; } | null; resolvedCallArgument(expression: Extract, index: number): Expression | null; /** The Look-arithmetic hints this walk records for the emitter, keyed by expression span. */ readonly extensionCalls: Map; /** * Operands probed for Look arithmetic. The core analyzer re-requests one * immediately after the probe declines, so the answer is parked here and * consumed once — that is what keeps operand analysis single-run and operand * diagnostics unrepeated. */ readonly probedOperandTypes: Map; /** The names this module declares as public configuration, from the program's own reading. Replaced per program. */ readonly publicConfigNames: ReadonlySet; /** D114 0.29.0 LC-D1: the manifest's `web.publicConfig`, or null when this compile read no project manifest. */ readonly webPublicConfig: Readonly> | null; /** The module's source, which is what a component-call refusal quotes the arguments out of. */ readonly webSourceText: string; fieldsOf(identity: string): ReadonlyMap | null; typeError(message: string, errorSpan: Span): void; } /** * The one face the inference rules read. It is an intersection because the * rules on either side of the core walk really do reach three other groups: a * call is checked as a Look builder call, a zero-argument call of a derived * name is refused, and an identifier read is recorded for the D71 migration. */ export type InferenceHost = ExpressionInferenceHost & LookAnalysisHost & ReactiveNamesHost & RetiredAccessorHost; /** * The Web shapes refused before the core analyzer sees the expression, in the * order they are asked. `undefined` means nothing here claimed the expression * and the extension dispatch continues. */ export declare function webExpressionShapeRefusals(host: InferenceHost, expression: Expression): ValueType | undefined; /** The two Web expressions that are a value rather than a walk: a misplaced Look hook, and a unit literal. */ export declare function webExtensionValueType(host: InferenceHost, expression: Expression): ValueType | undefined; /** * The answers the Web extension already holds for this expression, given back * instead of walking it a second time. Null means the core walk should run. */ export declare function answeredBeforeInference(host: InferenceHost, expression: Expression): ValueType | null; /** The compile-time Look length a builder call folds to, or null when the call is not one. */ export declare function foldedWebLength(host: InferenceHost, expression: Expression): ValueType | null; /** Infers one builder slot and parks the answer in the probe cache, so the call's own analysis reads it back. */ export declare function probedSlotType(host: InferenceHost, argument: Expression): ValueType; /** The two reports a call earns once the core walk has answered its type. */ export declare function reportInferredWebCall(host: InferenceHost, expression: Expression, result: ValueType): void; export declare function inferWebExtensionCall(host: InferenceHost, callee: ExtensionValueType, arguments_: readonly Expression[], argumentNames: readonly (string | null)[] | undefined, callSpan: Span): ValueType | undefined; export declare function validateWebExtensionTypeSyntax(host: InferenceHost, syntax: TypeSyntax, validate: (syntax: TypeSyntax) => boolean, resolve: (reference: TypeReference) => ValueType): boolean | undefined; //# sourceMappingURL=inference.d.ts.map