@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
22 lines • 725 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.collectAllIds = collectAllIds;
const visitor_1 = require("./processing/visitor");
/**
* Collects all node ids within a tree given by a respective root node
*
* @param nodes - The root id nodes to start collecting from
* @param stop - A function that determines whether to stop collecting at a given node, does not stop by default
*/
function collectAllIds(nodes, stop = () => false) {
const ids = new Set();
(0, visitor_1.visitAst)(nodes, (node) => {
if (stop(node)) {
return true;
}
ids.add(node.info.id);
return false;
});
return ids;
}
//# sourceMappingURL=collect.js.map