@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
27 lines (26 loc) • 1.55 kB
TypeScript
/**
* This module has one goal (and is to be rewritten soon to achieve that goal,
* as the file itself is way too long). See {@link reconstructToCode}.
* @module
*/
import type { NormalizedAst } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
import type { AutoSelectPredicate } from './auto-select/auto-select-defaults';
type Selection = ReadonlySet<NodeId>;
export declare const reconstructLogger: import("tslog").Logger<import("tslog").ILogObj>;
export interface ReconstructionResult {
code: string;
/** number of lines that contain nodes that triggered the `autoSelectIf` predicate {@link reconstructToCode} */
linesWithAutoSelected: number;
}
/**
* Reconstructs parts of a normalized R ast into R code on an expression basis.
*
* @param ast - The {@link NormalizedAst|normalized ast} to be used as a basis for reconstruction
* @param selection - The selection of nodes to be reconstructed (probably the {@link NodeId|NodeIds} identified by the slicer)
* @param autoSelectIf - A predicate that can be used to force the reconstruction of a node (for example to reconstruct library call statements, see {@link autoSelectLibrary}, {@link doNotAutoSelect})
*
* @returns The number of lines for which `autoSelectIf` triggered, as well as the reconstructed code itself.
*/
export declare function reconstructToCode(ast: NormalizedAst, selection: Selection, autoSelectIf?: AutoSelectPredicate): ReconstructionResult;
export {};