/** * Core narrowing builder types and utilities. * * Provides foundational types (BranchTruthiness, EmitExprAstFn, RuntimeUnionFrame), * simple AST builders for union narrowing, binding management helpers, * nullish guard construction/stripping, and type-narrowing predicates. */ import { IrExpression, IrType } from "@tsonic/frontend"; import type { EmitterContext, NarrowedBinding } from "../../types.js"; import type { CSharpExpressionAst } from "../format/backend-ast/types.js"; import { type NarrowedUnionMembers } from "./narrowed-union-resolution.js"; export type BranchTruthiness = "truthy" | "falsy"; export type EmitExprAstFn = (expr: IrExpression, context: EmitterContext) => [CSharpExpressionAst, EmitterContext]; export type RuntimeUnionFrame = NarrowedUnionMembers; export type RuntimeSubsetSourceInfo = { readonly sourceType: IrType; readonly sourceMembers?: readonly IrType[]; readonly sourceCandidateMemberNs?: readonly number[]; readonly runtimeUnionArity?: number; }; export declare const toReceiverAst: (receiver: string | CSharpExpressionAst) => CSharpExpressionAst; export declare const buildUnionNarrowAst: (receiver: string | CSharpExpressionAst, memberN: number) => CSharpExpressionAst; export declare const tryMapProjectedRuntimeMemberN: (receiver: string | CSharpExpressionAst, sourceMemberN: number) => number | undefined; export declare const buildMappedUnionNarrowAst: (receiver: string | CSharpExpressionAst, sourceMemberN: number) => CSharpExpressionAst; export declare const buildSubsetUnionType: (members: readonly IrType[]) => IrType | undefined; export declare const withoutNarrowedBinding: (context: EmitterContext, bindingKey: string) => EmitterContext; export declare const applyBinding: (bindingKey: string, binding: NarrowedBinding, context: EmitterContext) => EmitterContext; export declare const resolveRuntimeSubsetSourceInfo: (bindingKey: string, currentType: IrType, runtimeUnionFrame: RuntimeUnionFrame, context: EmitterContext) => RuntimeSubsetSourceInfo; export declare const buildExprBinding: (exprAst: CSharpExpressionAst, type: IrType | undefined, sourceType: IrType | undefined, storageExprAst?: CSharpExpressionAst, storageType?: IrType, carrierExprAst?: CSharpExpressionAst, carrierType?: IrType) => Extract; export declare const buildProjectedExprBinding: (exprAst: CSharpExpressionAst, type: IrType | undefined, sourceType: IrType | undefined, carrierExprAst: CSharpExpressionAst, storageType?: IrType, carrierType?: IrType) => Extract; export declare const resolveExistingNarrowingSourceType: (bindingKey: string, currentType: IrType | undefined, context: EmitterContext) => IrType | undefined; export declare const buildRuntimeSubsetExpressionAst: (expr: Extract, narrowed: Extract, context: EmitterContext) => [CSharpExpressionAst, EmitterContext] | undefined; export declare const buildConditionalNullishGuardAst: (sourceAst: CSharpExpressionAst, whenNonNull: CSharpExpressionAst, targetType: IrType, context: EmitterContext) => [CSharpExpressionAst, EmitterContext]; export declare const tryStripConditionalNullishGuardAst: (exprAst: CSharpExpressionAst) => CSharpExpressionAst | undefined; export declare const narrowTypeByNotAssignableTarget: (currentType: IrType | undefined, targetType: IrType | undefined, context: EmitterContext) => IrType | undefined; export declare const currentNarrowedType: (bindingKey: string, fallbackType: IrType | undefined, context: EmitterContext) => IrType | undefined; export declare const resolveRuntimeUnionFrame: (originalName: string, unionSourceType: IrType, context: EmitterContext) => NarrowedUnionMembers | undefined; export declare const isNullOrUndefined: (expr: IrExpression) => boolean; //# sourceMappingURL=narrowing-builder-core.d.ts.map