/** * Generator wrapper declaration emission. * * Builds wrapper classes as typed CSharp AST declarations (no text templates). */ import { IrFunctionDeclaration, IrType, IrTypeParameter } from "@tsonic/frontend"; import { EmitterContext } from "./types.js"; import type { CSharpTypeAst, CSharpTypeDeclarationAst, CSharpTypeParameterAst, CSharpTypeParameterConstraintAst } from "./core/format/backend-ast/types.js"; type GeneratorTypeArgs = { readonly yieldType: CSharpTypeAst; readonly returnType?: CSharpTypeAst; readonly nextType: CSharpTypeAst; readonly hasNextType: boolean; readonly newContext: EmitterContext; }; export type GeneratorLike = Pick; type GeneratorHelperTypeParameters = { readonly typeParameters: readonly CSharpTypeParameterAst[]; readonly constraints: readonly CSharpTypeParameterConstraintAst[]; readonly typeArguments: readonly CSharpTypeAst[]; readonly context: EmitterContext; }; export declare const getGeneratorHelperBaseName: (generator: GeneratorLike, context: EmitterContext, ownerName?: string) => string; export declare const usesExchangeBasedGeneratorLowering: (generator: GeneratorLike) => boolean; export declare const buildGeneratorHelperTypeArguments: (typeParameterNames: readonly string[] | undefined, context: EmitterContext) => readonly CSharpTypeAst[]; export declare const emitGeneratorHelperTypeParameters: (typeParameters: readonly IrTypeParameter[], context: EmitterContext) => GeneratorHelperTypeParameters; /** * Extract generator type arguments as CSharpTypeAst. * * Generator -> { yieldType, returnType?, nextType } */ export declare const extractGeneratorTypeArgs: (returnType: IrType | undefined, context: EmitterContext) => GeneratorTypeArgs; /** * Generate wrapper class declaration for a generator function. */ export declare const generateWrapperClass: (func: GeneratorLike, context: EmitterContext, helperBaseName?: string, helperTypeParameters?: readonly IrTypeParameter[]) => [CSharpTypeDeclarationAst, EmitterContext]; /** * Check if a generator function needs bidirectional support * (i.e., has TNext type parameter that isn't undefined) */ export declare const needsBidirectionalSupport: (func: GeneratorLike) => boolean; /** * Check if a generator function has a return type (TReturn is not void/undefined) */ export declare const hasGeneratorReturnType: (func: GeneratorLike) => boolean; export {}; //# sourceMappingURL=generator-wrapper.d.ts.map