UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

33 lines 1.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.identifyLinkToNestedRelation = identifyLinkToNestedRelation; const vertex_1 = require("../../../dataflow/graph/vertex"); const identifier_1 = require("../../../dataflow/environments/identifier"); const call_graph_1 = require("../../../dataflow/graph/call-graph"); /** * **Please refer to {@link identifyLinkToRelation}.** * * Links to the nested call context of the current function call. * This is useful for identifying calls made within nested functions * that should be associated with their parent function's call context. */ async function identifyLinkToNestedRelation(from, analyzer, { callName, ignoreIf }) { const df = await analyzer.dataflow(); if (ignoreIf?.(from, df.graph)) { return []; } const test = callName instanceof RegExp ? (t) => callName.test(t) : callName; const found = []; const cg = await analyzer.callGraph(); const subCg = call_graph_1.CallGraph.computeSubCallGraph(cg, new Set([from])); for (const [, t] of subCg.vertices(true)) { if (!(0, vertex_1.isFunctionCallVertex)(t)) { continue; } if (test(identifier_1.Identifier.toString(t.name))) { found.push(t.id); } } return found; } //# sourceMappingURL=identify-link-to-nested-call-relation.js.map