@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
30 lines • 1.21 kB
JavaScript
;
/**
* Provides utility types and functions to provide difference information if two structures
* are not equal. Maybe. Sometime, in the far future this will be as capable as the waldo package :dream:
*
* @module
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.setDifference = setDifference;
const set_1 = require("./set");
function setDifference(left, right, info) {
const lWithoutR = (0, set_1.setMinus)(left, right);
const rWithoutL = (0, set_1.setMinus)(right, left);
if (lWithoutR.size === 0 && rWithoutL.size === 0) {
return;
}
let message = info.position;
if (lWithoutR.size > 0 && !info.config.rightIsSubgraph) {
message += ` More elements in ${info.leftname}: ${JSON.stringify([...lWithoutR])}`;
}
if (rWithoutL.size > 0 && !info.config.leftIsSubgraph) {
message += lWithoutR.size > 0 ? ' and m' : 'M';
message += `ore in ${info.rightname}: ${JSON.stringify([...rWithoutL])}`;
}
if ((rWithoutL.size > 0 && !info.config.leftIsSubgraph)
|| (lWithoutR.size > 0 && !info.config.rightIsSubgraph)) {
info.report.addComment(message);
}
}
//# sourceMappingURL=diff.js.map