UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

49 lines (48 loc) 3.23 kB
import { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id'; import { type DataflowGraph } from '../../../dataflow/graph/graph'; import { type DataflowGraphVertexFunctionCall } from '../../../dataflow/graph/vertex'; import { RType } from '../../../r-bridge/lang-4.x/ast/model/type'; import type { RNodeWithParent } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate'; import type { LinkToLastCall } from './call-context-query-format'; import type { PromotedLinkTo } from './call-context-query-executor'; import type { ReadonlyFlowrAnalysisProvider } from '../../../project/flowr-analyzer'; import type { ControlFlowGraph } from '../../../control-flow/control-flow-graph'; export declare enum CallTargets { /** call targets a function that is not defined locally in the script (e.g., the call targets a library function) */ OnlyGlobal = "global", /** call targets a function that is defined locally or globally, but must include a global function */ MustIncludeGlobal = "must-include-global", /** call targets a function that is defined locally */ OnlyLocal = "local", /** call targets a function that is defined locally or globally, but must include a local function */ MustIncludeLocal = "must-include-local", /** call targets a function that is defined locally or globally */ Any = "any" } /** * Determines whether the given function call node satisfies the specified call target condition. */ export declare function satisfiesCallTargets(info: DataflowGraphVertexFunctionCall, graph: DataflowGraph, callTarget: CallTargets): NodeId[] | 'no'; /** * Gets the value node of the specified argument in the given function call, if it exists and matches the allowed types. */ export declare function getValueOfArgument<Types extends readonly RType[] = readonly RType[]>(graph: DataflowGraph, call: DataflowGraphVertexFunctionCall | undefined, argument: { name?: string; index: number; }, additionalAllowedTypes?: Types): (RNodeWithParent & { type: Types[number]; }) | undefined; /** * **Please refer to {@link identifyLinkToRelation}.** * * Identifies nodes that link to the last call of a specified function from a given starting node in the control flow graph. * If you pass on `knownCalls` (e.g., produced by {@link getCallsInCfg}), this will only respect the functions * listed there and ignore any other calls. This can be also used to speed up the process if you already have * the known calls available. * @see {@link identifyLinkToLastCallRelationSync} for the synchronous version. */ export declare function identifyLinkToLastCallRelation(from: NodeId, analyzer: ReadonlyFlowrAnalysisProvider, l: LinkToLastCall<RegExp> | PromotedLinkTo<LinkToLastCall<RegExp>>, knownCalls?: Map<NodeId, Required<DataflowGraphVertexFunctionCall>>): Promise<NodeId[]>; /** * Synchronous version of {@link identifyLinkToLastCallRelation}. */ export declare function identifyLinkToLastCallRelationSync(from: NodeId, cfg: ControlFlowGraph, graph: DataflowGraph, { callName, cascadeIf, ignoreIf }: LinkToLastCall<RegExp> | PromotedLinkTo<LinkToLastCall<RegExp>>, knownCalls?: Map<NodeId, Required<DataflowGraphVertexFunctionCall>>): NodeId[];