@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
14 lines (13 loc) • 847 B
TypeScript
import type { NoInfo, RNode } from '../model';
import type { EmptyArgument } from '../nodes/r-function-call';
/** Return `true` to stop visiting from this node (i.e., do not continue to visit this node *and* the children) */
export type OnEnter<OtherInfo> = (node: RNode<OtherInfo>) => (boolean | void);
/** Similar to {@link OnEnter} but called when leaving a node. Can't stop exploration as the subtree is already visited! */
export type OnExit<OtherInfo> = (node: RNode<OtherInfo>) => void;
export declare class NodeVisitor<OtherInfo = NoInfo> {
private readonly onEnter?;
private readonly onExit?;
constructor(onEnter?: OnEnter<OtherInfo>, onExit?: OnExit<OtherInfo>);
private visitSingle;
visit(nodes: RNode<OtherInfo> | readonly (RNode<OtherInfo> | null | undefined | typeof EmptyArgument)[] | undefined | null): void;
}