@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
22 lines • 862 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.instrumentDataflowCount = instrumentDataflowCount;
/**
* This takes the out parameter `countMap` and fills it with the count of how many times each RType was processed.
* The accompanying `reset` function can be used to reset the map to an empty state.
*/
function instrumentDataflowCount(countMap, reset) {
return (extractor, _ctx) => {
reset(countMap);
const instrumented = {};
for (const [key, processor] of Object.entries(extractor)) {
instrumented[key] = ((...args) => {
const prev = countMap.get(key) ?? 0;
countMap.set(key, prev + 1);
return processor(...args);
});
}
return instrumented;
};
}
//# sourceMappingURL=instrument-dataflow-count.js.map