UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

38 lines 1.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.executeProjectQuery = executeProjectQuery; const log_1 = require("../../../util/log"); const flowr_file_1 = require("../../../project/context/flowr-file"); /** * Executes the given project queries. */ async function executeProjectQuery({ analyzer }, queries) { if (queries.length !== 1) { log_1.log.warn('Project query expects only up to one query, but got', queries.length); } const startTime = Date.now(); const withDf = queries.some(q => q.withDf); // we need to know what is considered by the analyzer if (withDf) { await analyzer.dataflow(); } const descFile = analyzer.inspectContext().files.getFilesByRole(flowr_file_1.FileRole.Description); const desc = descFile[0]; const roleCounts = {}; for (const file of Object.values(flowr_file_1.FileRole)) { roleCounts[file] = analyzer.inspectContext().files.getFilesByRole(file).length; } return { '.meta': { timing: Date.now() - startTime }, name: desc?.content().get('Package')?.[0] ?? desc?.content()?.get('Title')?.[0], files: Array.from(analyzer.inspectContext().files.consideredFilesList()), authors: desc?.authors(), encoding: desc?.content().get('Encoding')?.[0], version: desc?.content().get('Version')?.[0], licenses: desc?.license(), roleCounts: roleCounts }; } //# sourceMappingURL=project-query-executor.js.map