@eagleoutice/flowr-dev
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
45 lines (44 loc) • 2.39 kB
TypeScript
import { type Fingerprint } from './fingerprint';
import type { NodeToSlice, SliceResult } from './slicer-types';
import type { REnvironmentInformation } from '../../dataflow/environments/environment';
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
import type { DataflowGraphVertexInfo } from '../../dataflow/graph/vertex';
import type { ReadOnlyFlowrAnalyzerGasContext } from '../../project/context/flowr-analyzer-gas-context';
export declare class VisitingQueue {
private readonly threshold;
private timesHitThreshold;
private readonly seen;
private readonly seenByCache;
private readonly idThreshold;
private readonly queue;
private readonly cache?;
potentialAdditions: Map<NodeId, [NodeId, NodeToSlice]>;
private cachedCallTargets;
/** whether the dataflow graph has a vertex for an id, i.e. whether the traversal could continue from it */
private readonly isGraphVertex?;
private readonly gas?;
private stoppedEarly;
private untilGasCheck;
/** entries dequeued, see {@link SliceProgress} */
private visited;
constructor(threshold: number, cache?: Map<Fingerprint, Set<NodeId>>, isGraphVertex?: (id: NodeId) => boolean, gas?: ReadOnlyFlowrAnalyzerGasContext);
/**
* Adds a node to the queue if it has not been seen before.
* @param target - the node to add
* @param env - the environment the node is traversed in
* @param envFingerprint - the fingerprint of the environment
* @param onlyForSideEffects - whether the node is only used for its side effects
*/
add(target: NodeId, env: REnvironmentInformation, envFingerprint: string, onlyForSideEffects: boolean): void;
next(): NodeToSlice;
/** Whether there is anything left to visit, which the traversal is out of gas for as soon as it is exhausted. */
nonEmpty(): boolean;
/**
* The traversal is synchronous, so a caller can only bound it from within. Gas is polled every
* {@link GasCheckEvery} nodes, which keeps even an enabled check off the per-node path.
*/
private outOfGas;
hasId(id: NodeId): boolean;
memoizeCallTargets(id: NodeId, targets: () => Set<DataflowGraphVertexInfo>): Set<DataflowGraphVertexInfo>;
status(): Readonly<Pick<SliceResult, 'timesHitThreshold' | 'result' | 'stoppedEarly' | 'progress'>>;
}