import { Cursor } from '../..'; import { J } from '../../java'; import { JS } from '..'; import { JavaScriptVisitor } from '../visitor'; import { Parameter } from './types'; /** * Visitor that replaces placeholder nodes with actual parameter values. */ export declare class PlaceholderReplacementVisitor extends JavaScriptVisitor { private readonly substitutions; private readonly values; private readonly wrappersMap; constructor(substitutions: Map, values?: Pick, 'get'>, wrappersMap?: Pick | J.RightPadded[]>, 'get'>); visit(tree: J, p: any, parent?: Cursor): Promise; /** * Override visitBindingElement to preserve propertyName from template when replacing. * For example, in `{ ref: ${ref} }`, we want to preserve `ref:` when replacing ${ref}. */ visitBindingElement(bindingElement: JS.BindingElement, p: any): Promise; /** * Override visitContainer to handle variadic expansion for containers. * This handles J.Container instances anywhere in the AST (method arguments, etc.). */ visitContainer(container: J.Container, p: any): Promise>; /** * Override visitRightPadded to handle single placeholder replacements. * The base implementation will visit the element, which triggers our visit() override * for placeholder detection and replacement. */ visitRightPadded(right: J.RightPadded, p: any): Promise | undefined>; /** * Override visitBlock to handle variadic expansion in block statements. * Block.statements is J.RightPadded[] (not a Container), so we need * array-level access for variadic expansion. */ visitBlock(block: J.Block, p: any): Promise; /** * Override visitJsCompilationUnit to handle variadic expansion in top-level statements. * CompilationUnit.statements is J.RightPadded[] (not a Container), so we need * array-level access for variadic expansion. */ visitJsCompilationUnit(compilationUnit: JS.CompilationUnit, p: any): Promise; /** * Merges prefixes by preserving comments from the source element * while using whitespace from the template placeholder. * * @param sourcePrefix The prefix from the captured element (may contain comments) * @param templatePrefix The prefix from the template placeholder (defines whitespace) * @returns A merged prefix with source comments and template whitespace */ private mergePrefix; /** * Expands variadic placeholders in a list of elements. * * @param elements The list of wrapped elements to process * @param unwrapElement Optional function to unwrap the placeholder node from its container (e.g., ExpressionStatement) * @param p Context parameter for visitor * @returns Promise of new list with placeholders expanded */ private expandVariadicElements; /** * Checks if a node is a placeholder. * * @param node The node to check * @returns True if the node is a placeholder */ private isPlaceholder; /** * Replaces a placeholder node with the actual parameter value. * * @param placeholder The placeholder node * @returns The replacement node or the original if not a placeholder */ private replacePlaceholder; /** * Gets the placeholder text from a node. * * @param node The node to get placeholder text from * @returns The placeholder text or null */ private getPlaceholderText; } //# sourceMappingURL=placeholder-replacement.d.ts.map