qdoc: Correctly resolve non-function links that end in parentheses

If QDoc fails to find a function node for a link target that ends
in parentheses, it must retry to find another type of node, as
page/section titles can sometimes resemble function signatures.

This fixes a regression introduced by commit 8c5ce68f.

Change-Id: I675fe5b93ecc8a1823c0a5f817fb4b80b4e63320
Task-number: QTBUG-47919
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Reviewed-by: Martin Smith <martin.smith@digia.com>
This commit is contained in:
Topi Reinio 2015-08-25 16:00:01 +02:00 committed by Topi Reiniö
parent 6313ff8a62
commit 72e5fda3bd

View File

@ -306,15 +306,12 @@ const Node* QDocForest::findNodeForTarget(QStringList& targetPath,
{
int flags = SearchBaseClasses | SearchEnumValues;
QString entity = targetPath.at(0);
targetPath.removeFirst();
QString entity = targetPath.takeFirst();
QStringList entityPath = entity.split("::");
QString target;
if (!targetPath.isEmpty()) {
target = targetPath.at(0);
targetPath.removeFirst();
}
if (!targetPath.isEmpty())
target = targetPath.takeFirst();
foreach (Tree* t, searchOrder()) {
const Node* n = t->findNodeForTarget(entityPath, target, relative, flags, genus, ref);
@ -1703,37 +1700,28 @@ const Node* QDocDatabase::findNodeForAtom(const Atom* a, const Node* relative, Q
function = first.left(position);
node = domain->findFunctionNode(function, params, 0, genus);
}
else {
if (!node) {
int flags = SearchBaseClasses | SearchEnumValues;
QStringList nodePath = first.split("::");
QString target;
targetPath.removeFirst();
if (!targetPath.isEmpty()) {
target = targetPath.at(0);
targetPath.removeFirst();
}
if (!targetPath.isEmpty())
target = targetPath.takeFirst();
if (relative && relative->tree()->physicalModuleName() != domain->physicalModuleName())
relative = 0;
node = domain->findNodeForTarget(nodePath, target, relative, flags, genus, ref);
return node;
return domain->findNodeForTarget(nodePath, target, relative, flags, genus, ref);
}
}
else {
if (first.endsWith(".html")) {
if (first.endsWith(".html"))
node = findNodeByNameAndType(QStringList(first), Node::Document);
// the path may also refer to an example file with .html extension
if (!node && first.contains("/"))
return findNodeForTarget(targetPath, relative, genus, ref);
}
else if (first.endsWith(QChar(')'))) {
node = findFunctionNode(first, relative, genus);
if (Generator::debugging())
qDebug() << " node:" << node;
}
else {
node = findNodeForTarget(targetPath, relative, genus, ref);
return node;
}
if (!node)
return findNodeForTarget(targetPath, relative, genus, ref);
}
if (node && ref.isEmpty()) {