jsdoc: change parser to allow for multiply symbols of the same name.

This commit is contained in:
Jonathan Puckey 2011-05-28 02:11:30 +02:00
parent 1520cad144
commit f78259f8de

View file

@ -52,19 +52,13 @@ JSDOC.Parser = {
} }
} }
// if a symbol alias is documented more than once the first one with the user docs wins // if a symbol alias is documented more than once, add ^n to its alias:
if (JSDOC.Parser.symbols.hasSymbol(symbol.alias)) { if (JSDOC.Parser.symbols.hasSymbol(symbol.alias)) {
var oldSymbol = JSDOC.Parser.symbols.getSymbol(symbol.alias); var num = 0;
if (oldSymbol.comment.isUserComment) { while (JSDOC.Parser.symbols.hasSymbol(symbol.alias + '^' + num)) {
if (JSDOC.opt.m) return; num++;
if (symbol.comment.isUserComment) { // old and new are both documented
LOG.warn("The symbol '"+symbol.alias+"' is documented more than once.");
return;
}
else { // old is documented but new isn't
return;
}
} }
symbol.alias = symbol.alias + '^' + num;
} }
// we don't document anonymous things // we don't document anonymous things