Bug 1250966 - Ignore retaining paths that are strictly a super set of other paths. r=jimb

This commit is contained in:
Nick Fitzgerald 2016-04-06 16:23:00 -04:00
Родитель d43e3c8bdb
Коммит d6a64fd361
2 изменённых файлов: 14 добавлений и 4 удалений

Просмотреть файл

@ -48,8 +48,20 @@ exports.deduplicatePaths = function (target, paths) {
nameSet.add(name);
}
for (let path of paths) {
outer: for (let path of paths) {
const pathLength = path.length;
// Check for duplicate predecessors in the path, and skip paths that contain
// them.
const predecessorsSeen = new Set();
predecessorsSeen.add(target);
for (let i = 0; i < pathLength; i++) {
if (predecessorsSeen.has(path[i].predecessor)) {
continue outer;
}
predecessorsSeen.add(path[i].predecessor);
}
for (let i = 0; i < pathLength - 1; i++) {
insert(path[i].predecessor, path[i + 1].predecessor, path[i].edge);
}

Просмотреть файл

@ -104,12 +104,10 @@ function run_test() {
pathEntry(f, "f->g"),
],
],
expectedNodes: [a, b, f, g],
expectedNodes: [a, b, g],
expectedEdges: [
edge(a, b, "a->b"),
edge(b, g, "b->g"),
edge(g, f, "g->f"),
edge(f, g, "f->g"),
]
});
}