зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1250966 - Ignore retaining paths that are strictly a super set of other paths. r=jimb
This commit is contained in:
Родитель
d43e3c8bdb
Коммит
d6a64fd361
|
@ -48,8 +48,20 @@ exports.deduplicatePaths = function (target, paths) {
|
||||||
nameSet.add(name);
|
nameSet.add(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let path of paths) {
|
outer: for (let path of paths) {
|
||||||
const pathLength = path.length;
|
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++) {
|
for (let i = 0; i < pathLength - 1; i++) {
|
||||||
insert(path[i].predecessor, path[i + 1].predecessor, path[i].edge);
|
insert(path[i].predecessor, path[i + 1].predecessor, path[i].edge);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,12 +104,10 @@ function run_test() {
|
||||||
pathEntry(f, "f->g"),
|
pathEntry(f, "f->g"),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
expectedNodes: [a, b, f, g],
|
expectedNodes: [a, b, g],
|
||||||
expectedEdges: [
|
expectedEdges: [
|
||||||
edge(a, b, "a->b"),
|
edge(a, b, "a->b"),
|
||||||
edge(b, g, "b->g"),
|
edge(b, g, "b->g"),
|
||||||
edge(g, f, "g->f"),
|
|
||||||
edge(f, g, "f->g"),
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче