UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

43 lines 2.44 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.StaticSliceQueryDefinition = void 0; const ansi_1 = require("../../../util/ansi"); const time_1 = require("../../../util/time"); const joi_1 = __importDefault(require("joi")); const static_slice_query_executor_1 = require("./static-slice-query-executor"); const query_print_1 = require("../../query-print"); exports.StaticSliceQueryDefinition = { executor: static_slice_query_executor_1.executeStaticSliceQuery, asciiSummarizer: (formatter, _processed, queryResults, result) => { const out = queryResults; result.push(`Query: ${(0, ansi_1.bold)('static-slice', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`); for (const [fingerprint, obj] of Object.entries(out.results)) { const { criteria, noMagicComments, noReconstruction } = JSON.parse(fingerprint); const addons = []; if (noReconstruction) { addons.push('no reconstruction'); } if (noMagicComments) { addons.push('no magic comments'); } result.push(` ╰ Slice for {${criteria.join(', ')}} ${addons.join(', ')}`); if ('reconstruct' in obj) { result.push(' ╰ Code (newline as <code>&#92;n</code>): <code>' + obj.reconstruct.code.split('\n').join('\\n') + '</code>'); } else { result.push(` ╰ Id List: {${(0, query_print_1.summarizeIdsIfTooLong)(formatter, [...obj.slice.result])}}`); } } return true; }, schema: joi_1.default.object({ type: joi_1.default.string().valid('static-slice').required().description('The type of the query.'), criteria: joi_1.default.array().items(joi_1.default.string()).min(0).required().description('The slicing criteria to use.'), noReconstruction: joi_1.default.boolean().optional().description('Do not reconstruct the slice into readable code.'), noMagicComments: joi_1.default.boolean().optional().description('Should the magic comments (force-including lines within the slice) be ignored?') }).description('Slice query used to slice the dataflow graph') }; //# sourceMappingURL=static-slice-query-format.js.map