@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
34 lines • 1.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.processSpecialBinOp = processSpecialBinOp;
const known_call_handling_1 = require("../known-call-handling");
const logger_1 = require("../../../../../logger");
const edge_1 = require("../../../../../graph/edge");
function processSpecialBinOp(name, args, rootId, data, config) {
if (!config.lazy) {
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data }).information;
}
else if (args.length != 2) {
logger_1.dataflowLogger.warn(`Logical bin-op ${name.content} has something else than 2 arguments, skipping`);
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs }).information;
}
const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs,
patchData: (d, i) => {
if (i === 1) {
return { ...d, controlDependencies: [...d.controlDependencies ?? [], { id: name.info.id, when: config.evalRhsWhen }] };
}
return d;
}
});
for (const arg of processedArguments) {
if (arg) {
information.graph.addEdge(name.info.id, arg.entryPoint, edge_1.EdgeType.Reads);
}
// only do first if lazy
if (config.lazy) {
break;
}
}
return information;
}
//# sourceMappingURL=built-in-special-bin-op.js.map