@eagleoutice/flowr-dev
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
36 lines (35 loc) • 2.04 kB
TypeScript
import type { ControlFlowGraph } from '../../../../../control-flow/control-flow-graph';
import type { AstIdMap, ParentInformation } from '../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
import { NodeId } from '../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
import type { DataflowGraph } from '../../../../graph/graph';
import { linkExpressionIn } from '../../../linker';
/**
* A language object reads nothing where it is written and everything where it reaches `eval`, with the bindings
* in effect there. Working on the finished graph makes assignments, branches, loops, and calls one traversal.
* @example
* ```ts
* Quoted.capturedBy(graph, id); // the expression a `quote(...)` holds on to
* Quoted.sourcesOf(graph, id); // every expression the value at `id` may hold
* ```
*/
export declare const Quoted: {
readonly name: "Quoted";
/** The expression a capturing call holds on to. */
readonly capturedBy: (this: void, graph: DataflowGraph, id: NodeId) => NodeId | undefined;
/** Every expression the value at `id` may hold, with the call that captured it. Several is normal. */
readonly sourcesOf: (this: void, graph: DataflowGraph, id: NodeId) => readonly CapturedExpression[];
/** Links every name in `expr` against `environment` and hands back what stays unresolved. */
readonly evaluateIn: typeof linkExpressionIn;
/**
* The finishing pass over a complete graph: it settles what a call really evaluates, which the call itself
* could not know. A capture reaches the `eval` that forces it, a promise reaches the bindings it may be
* forced against, and a masked name the caller binds after all loses its mark.
*/
readonly finalize: <Info>(this: void, graph: DataflowGraph, idMap: AstIdMap<Info & ParentInformation>, controlFlow: () => ControlFlowGraph | undefined) => void;
};
interface CapturedExpression {
readonly expr: NodeId;
/** the capturing call, whose scope encloses `expr` */
readonly at: NodeId;
}
export {};