/** * Tree walker for IRNode — ESLint-style type-keyed visitors with flow control. */ import type { IRNode } from './types.js'; export interface WalkContext { /** Skip visiting children of the current node */ skip(): void; /** Stop the entire traversal */ stop(): void; /** The parent node, if any */ parent: IRNode | undefined; /** Depth from root (0 = root) */ depth: number; } /** Visitor callback function */ export type VisitorFn = (node: IRNode, ctx: WalkContext) => void; /** A visitor can be a function (enter only) or { enter?, leave? } */ export type Visitor = VisitorFn | { enter?: VisitorFn; leave?: VisitorFn; }; /** Visitor map keyed by node type, plus optional '*' wildcard */ export type VisitorMap = Record; /** * Walk an IR tree depth-first, calling visitors for matching node types. * Supports type-keyed visitors and a '*' wildcard. */ export declare function walkIR(root: IRNode, visitors: VisitorMap): void; /** * Find the deepest IR node whose source location contains the given position. * * Essential for LSP hover, completion, and go-to-definition. * Requires nodes to have `loc` with `endLine`/`endCol` for accurate results. * * @param root - The root IR node to search * @param line - 1-based line number * @param col - 1-based column number * @returns The deepest matching node, or `undefined` if no node spans the position */ export declare function getNodeAtPosition(root: IRNode, line: number, col: number): IRNode | undefined;