/** * The declaration statement heads: `const`/`let`, `type`, `enum` and `class`. * * D114 R1f: what these four share is the question this module answers — where * a declaration may stand, and what the name it introduces is bound to. The * bodies of three of them belong to clusters that already own them * (`declarations/records.ts`, `classes/members.ts`), so those arms are the * module-scope refusal plus the one call that hands the body over; the `enum` * member checks and the whole of a variable declaration are here because * nothing else owns them. */ import { type BindingPattern, type Expression, type Statement, type TypeReference } from "../../ast.ts"; import { type Diagnostic } from "../../diagnostic.ts"; import { type Span } from "../../source.ts"; import { type ValueType } from "../../types.ts"; import { type EmptyCollectionTarget } from "../expressions/contextual.ts"; import { type Binding, type MutableCellTarget } from "../scopes.ts"; import type { ConstantValue } from "../constant-values.ts"; import type { PromiseInspectionSite } from "../advisories/promises.ts"; /** * Everything the declaration statements ask of the analyzer that hosts them, * and nothing more. The scope stack is a live read: a declaration writes into * the scope it is standing in. */ export interface DeclarationStatementsHost { analyzeClassBody(statement: Extract): void; analyzeRecordTypeDeclaration(statement: Extract): void; assignedFactDomain(expression: Expression, inferred: ValueType): ValueType; carriedOwnedResource(expression: Expression | null): { readonly handle: string; readonly depth: number; } | null; claimArrowDeferredFrame(pattern: BindingPattern, initializer: Expression): void; collectPatternNames(pattern: BindingPattern, add: (name: string) => void): void; declarePattern(pattern: BindingPattern, mutable: boolean, type: ValueType, declaredType?: ValueType): void; constantValue(expression: Expression): ConstantValue | undefined; bindConstantValue(binding: Binding, value: ConstantValue | undefined): void; promiseInspectionSite(expression: Expression): PromiseInspectionSite | null; bindPromiseInspectionAlias(binding: Binding, site: PromiseInspectionSite | null): void; importedMemberOf(name: string): { readonly source: string; readonly imported: string | null; } | null; bindImportedAlias(binding: Binding, origin: { readonly source: string; readonly imported: string | null; } | null): void; readonly diagnostics: Diagnostic[]; establishAssignedPatternFacts(pattern: BindingPattern, assigned: ValueType): void; expandAliases(type: ValueType, seen?: ReadonlySet): ValueType; inferExpression(expression: Expression, contextualType?: ValueType): ValueType; readonly promiseInitializerBindings: WeakSet; recordBindingHoleSource(pattern: BindingPattern, initializer: Expression, reported: boolean): void; refuseGuidedDeclarationName(name: string, position: string, declarationSpan: Span): boolean; reportExportedAny(exported: readonly string[], span: Span): void; requireAssignable(actual: ValueType, expected: ValueType, valueSpan: Span, mutableCell?: MutableCellTarget | null): void; requireSettledCollectionElement(initializer: Expression, declared: ValueType, annotated: boolean, target?: EmptyCollectionTarget | null): boolean; resolveAnnotation(reference: TypeReference | null): ValueType; readonly scopes: Map[]; validateKnownBindingShape(pattern: BindingPattern, value: Expression): void; validateTypeReference(reference: TypeReference, resolve?: (reference: TypeReference) => ValueType): boolean; widenAggregateSingleton(type: ValueType): ValueType; } export declare class DeclarationStatements { private readonly host; constructor(host: DeclarationStatementsHost); analyzeTypeDeclaration(statement: Extract): void; analyzeEnumDeclaration(statement: Extract): void; analyzeClassDeclaration(statement: Extract): void; analyzeVariableDeclaration(statement: Extract): void; } //# sourceMappingURL=variables.d.ts.map