UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

32 lines 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.executeDataflowLensQuery = executeDataflowLensQuery; const log_1 = require("../../../util/log"); const dfg_view_1 = require("../../../util/simple-df/dfg-view"); const vertex_1 = require("../../../dataflow/graph/vertex"); /** * Executes the given dataflow lens queries using the provided analyzer. */ async function executeDataflowLensQuery({ analyzer }, queries) { if (queries.length !== 1) { log_1.log.warn('Dataflow query expects only up to one query, but got', queries.length); } const now = Date.now(); const simplifiedGraph = (0, dfg_view_1.reduceDfg)((await analyzer.dataflow()).graph, { vertices: { keepEnv: false, keepCd: true, tags: [vertex_1.VertexType.Use, vertex_1.VertexType.VariableDefinition, vertex_1.VertexType.FunctionDefinition, vertex_1.VertexType.FunctionCall], nameRegex: '<-|<<-|->|->>|=|+|-|*|/|\\|>|function|repeat|if|next|break', blacklistWithName: true } }, analyzer.inspectContext().env.makeCleanEnv()); const timing = Date.now() - now; return { '.meta': { timing }, simplifiedGraph }; } //# sourceMappingURL=dataflow-lens-query-executor.js.map