/**
 * Yield Lowering Helpers
 *
 * Shared types, utilities, and yield-detection functions used by
 * yield-expression-lowering and yield-statement-lowering sub-modules.
 */
import { Diagnostic, SourceLocation } from "../../types/diagnostic.js";
import { IrStatement, IrExpression, IrYieldStatement, IrGeneratorReturnStatement, IrYieldExpression, IrPattern, IrType } from "../types.js";
/**
 * Context for tracking state during yield lowering
 */
export type LoweringContext = {
    readonly filePath: string;
    readonly diagnostics: Diagnostic[];
    /** True if we're inside a generator function */
    readonly inGenerator: boolean;
    yieldTempCounter: number;
};
/**
 * Result of lowering an expression that contains yield sub-expressions.
 */
export type LoweredExpressionWithYields = {
    readonly prelude: readonly IrStatement[];
    readonly expression: IrExpression;
};
/**
 * Create a source location for a module
 */
export declare const moduleLocation: (ctx: LoweringContext) => SourceLocation;
/**
 * Check if an expression contains a yield expression anywhere in its tree.
 */
export declare const containsYield: (expr: IrExpression) => boolean;
/**
 * Count the number of yield expressions in an expression tree.
 */
export declare const countYields: (expr: IrExpression) => number;
/**
 * Create an IrYieldStatement from a yield expression.
 */
export declare const createYieldStatement: (yieldExpr: IrYieldExpression, receiveTarget: IrPattern | undefined, receivedType: IrType | undefined) => IrYieldStatement;
export declare const toReceivePattern: (target: IrExpression | IrPattern) => IrPattern | undefined;
/**
 * Create an IrGeneratorReturnStatement from a return statement's expression.
 * This captures the return value for generators with TReturn.
 */
export declare const createGeneratorReturnStatement: (expression: IrExpression | undefined) => IrGeneratorReturnStatement;
/**
 * Emit diagnostic for unsupported yield position.
 */
export declare const emitUnsupportedYieldDiagnostic: (ctx: LoweringContext, position: string, location?: SourceLocation) => void;
export declare const allocateYieldTempName: (ctx: LoweringContext) => string;
export declare const createTempVariableDeclaration: (name: string, initializer: IrExpression, inferredType?: IrType) => IrStatement;
/**
 * Type guard to check if a result is a single statement (has 'kind' property).
 */
export declare const isSingleStatement: (result: IrStatement | readonly IrStatement[]) => result is IrStatement;
/**
 * Flatten a statement result to a single statement (wrap in block if needed).
 */
export declare const flattenStatement: (result: IrStatement | readonly IrStatement[]) => IrStatement;
export declare const addResidualYieldDiagnostics: (ctx: LoweringContext, value: unknown) => void;
//# sourceMappingURL=yield-lowering-helpers.d.ts.map