Variable should be reset on each loop but wasn't

The ancestors variable is always set once the first augmented doclet is found.
The incompleteDoclet variable is also not reset between loops.
This commit is contained in:
Maximilian Krög
2020-02-04 21:45:26 +01:00
parent 2e4f989d7b
commit c0f058f5cf

View File

@@ -42,15 +42,15 @@ exports.handlers = {
parseComplete: function(e) {
let ancestors, candidate, candidates, doclet, i, j, k, l, key;
let incompleteDoclet, stability, incomplete, incompletes;
let stability, incomplete, incompletes;
const doclets = e.doclets;
for (i = doclets.length - 1; i >= 0; --i) {
doclet = doclets[i];
if (doclet.augments) {
ancestors = [].concat(doclet.augments);
}
incompletes = incompleteByClass[doclet.longname];
if (ancestors && incompletes) {
if (!doclet.augments || !incompletes) {
continue;
}
ancestors = doclet.augments.slice();
// collect ancestors from the whole hierarchy
for (j = 0; j < ancestors.length; ++j) {
candidates = lookup[ancestors[j]];
@@ -58,12 +58,13 @@ exports.handlers = {
for (k = candidates.length - 1; k >= 0; --k) {
candidate = candidates[k];
if (candidate.augments) {
ancestors = ancestors.concat(candidate.augments);
Array.prototype.push.apply(ancestors, candidate.augments);
}
}
}
}
// walk through all inheritDoc members
let incompleteDoclet;
for (j = incompletes.length - 1; j >= 0; --j) {
incomplete = incompletes[j];
candidates = lookup[doclet.longname + '#' + incomplete];
@@ -105,6 +106,5 @@ exports.handlers = {
}
}
}
}
};