/** * Declaring a name: the symbol one declaration publishes, the scope it is * declared in, and the two module-boundary forms — an `import` and a * `re-export` — whose declarations name another module. * * D115 §三 / D114 R1f: the declaration half of `semantic.ts`, joined by the two * display functions that were `semantic-declarations.ts`. */ import type { ContextMarker, ImportDeclaration, ReExportDeclaration, TypeParameterDeclaration } from "../ast.ts"; import { type SourceText, type Span } from "../source.ts"; import { type ValueType } from "../types.ts"; import { type Scope, type SemanticImport, type SemanticModuleReference, type SemanticSymbol, type SemanticMember, type SemanticSymbolKind, type DeclareOptions } from "./symbols.ts"; /** What the declaration half asks of the index that hosts it, and nothing more. */ export interface SemanticDeclarationsHost { readonly allScopes: Scope[]; readonly bindingMembers: ReadonlyMap>; readonly bindingTypes: ReadonlyMap; callable(type: ValueType | undefined): boolean; readonly contextMarkersBySpecificity: readonly ContextMarker[]; readonly declarations: WeakMap; describeMembers(memberTypes: ReadonlyMap): readonly SemanticMember[]; readonly imports: SemanticImport[]; readonly moduleReferences: SemanticModuleReference[]; moduleSourceSpan(valueSpan: Span): Span; nextScopeId: number; readonly scopes: Scope[]; semanticIdentity(type: ValueType | undefined): string | null; readonly source: SourceText; readonly symbols: SemanticSymbol[]; } export declare class SemanticDeclarations { private readonly host; constructor(host: SemanticDeclarationsHost); contextMarkerFor(declarationSpan: Span): ContextMarker | undefined; currentScope(): Scope; enterScope(scopeSpan: Span): void; exitScope(): void; declare(owner: object, name: string, kind: SemanticSymbolKind, declarationSpan: Span, selectionSpan: Span, exported?: boolean, mutable?: boolean, lexical?: boolean, container?: string, explicitType?: string, staticMember?: boolean, options?: DeclareOptions): SemanticSymbol; declareImport(statement: ImportDeclaration): void; declareReExport(statement: ReExportDeclaration): void; } /** * The display text a generic record or class declaration publishes for itself. * A `def` carries its parameters into a hover through the function type it * describes; a class and a record have no such type — their symbols read back * the bare name, so `class Stack` hovered as `class Stack: Stack` * and `type Box` as `type Box: Box`, and the reader was never told the * declaration takes a parameter at all, let alone what it must satisfy. A * declaration with no parameters answers `undefined` and keeps the type its * binding already describes. */ export declare function declaredTypeParameters(name: string, parameters: readonly TypeParameterDeclaration[] | undefined): string | undefined; /** * How a symbol's own type is written. Ordinary symbols use `describeType`, * which erases type-parameter bounds: `def top` hovered as * `(…)` while the class beside it showed `Stack` — one * declaration, two answers about the same list. A *declaration* asks for the * bounded form, and gets it by naming each parameter the way the declaration * spells it and letting `describeType` render the rest, so the two displays * cannot drift apart. */ export declare function declarationTypeDisplay(type: ValueType, bounded: boolean): string; //# sourceMappingURL=declarations.d.ts.map