/** * The expression forms that are neither a literal, a call, nor a binary * operator: `await` and the other unary operators, `!` (required), `try`, the * ternary, `is`, and an index read. * * D115 §三: these were six private methods of `Analyzer`, each the whole of one * arm of the expression dispatcher. They share no state and answer no common * question — what they share is that each is one syntactic form's typing rule, * which is what this file is. */ import { type Expression, type TypeReference } from "../../ast.ts"; import { type Diagnostic, type DiagnosticFix } from "../../diagnostic.ts"; import { type Span } from "../../source.ts"; import { type ValueType } from "../../types.ts"; import { type FlowFactInvalidations, type FlowFactsSnapshot } from "../flow/facts.ts"; import { LoweringRecorder } from "../lowering-recorder.ts"; import { type MutableCellTarget } from "../scopes.ts"; /** What the operator expressions asks of the analyzer that hosts it, and nothing more. */ export interface OperatorExpressionsHost { allowBareGenericClassName(reference: TypeReference): void; analyzeIsolatedFlow(snapshot: FlowFactsSnapshot, analyze: () => void): FlowFactInvalidations; applyFlowInvalidations(branches: readonly FlowFactInvalidations[], includeBaseline?: boolean): void; readonly asynchronousFunctions: boolean[]; awaitedOperandContext(contextualType: ValueType): ValueType; boundaryValidationGuidance(expression: Expression | null, property: string | null): string; readonly classFieldInitializerDepth: number; readonly constructorDepth: number; readonly contextualAssignments: Map; contextualObjectType(type: ValueType, expression?: Extract): Extract | null; contextuallyAssignable(actual: ValueType, expected: ValueType, valueSpan: Span): boolean; readonly diagnostics: Diagnostic[]; expandAliases(type: ValueType, seen?: ReadonlySet): ValueType; readonly functionDepth: number; inferExpression(expression: Expression, contextualType?: ValueType): ValueType; inferNarrowedExpression(expression: Expression, narrowed: ReadonlyMap, contextualType: ValueType): ValueType; invalidExtensionAwaitContext(): boolean; invalidExtensionAwaitMessage(): string | null; readonly lowering: LoweringRecorder; narrowingFor(expression: Expression, knownType?: ValueType): ReadonlyMap; negativeNarrowingFor(expression: Expression, knownType?: ValueType): ReadonlyMap; optionalExecutionNarrowings(expression: Expression): ReadonlyMap; readonly parameterDefaultDepth: number; readonlyDataViewOf(type: ValueType): ValueType; rejectDisjointEnumTest(subjectSource: ValueType, checked: ValueType, operator: "is" | "is not", span: Span): void; rejectErasedRuntimeCheck(checked: ValueType, errorSpan: Span): boolean; reportPromiseResolutionHazard(type: ValueType, errorSpan: Span): void; requireAssignable(actual: ValueType, expected: ValueType, valueSpan: Span, mutableCell?: MutableCellTarget | null): void; requireCondition(type: ValueType, condition: Expression): void; resolveAnnotation(reference: TypeReference | null): ValueType; snapshotFlowFacts(): FlowFactsSnapshot; typeError(message: string, errorSpan: Span, fix?: DiagnosticFix): void; validateTypeReference(reference: TypeReference, resolve?: (reference: TypeReference) => ValueType): boolean; withTemporaryNarrowings(narrowed: ReadonlyMap, narrowingSpan: Span, analyze: () => T): T; } export declare class OperatorExpressions { private readonly host; constructor(host: OperatorExpressionsHost); inferUnary(expression: Extract, contextualType: ValueType): ValueType; inferRequired(expression: Extract, contextualType: ValueType): ValueType; inferTry(expression: Extract, contextualType: ValueType): ValueType; inferConditional(expression: Extract, contextualType: ValueType): ValueType; inferIs(expression: Extract, contextualType: ValueType): ValueType; inferIndex(expression: Extract, contextualType: ValueType): ValueType; } //# sourceMappingURL=operators.d.ts.map