diff options
author | Topi Reinio <topi.reinio@digia.com> | 2015-08-25 16:00:01 +0200 |
---|---|---|
committer | Topi Reiniƶ <topi.reinio@digia.com> | 2015-09-07 11:11:34 +0000 |
commit | 72e5fda3bd1b50ee3e0da0b5ef6505e632f7f5bc (patch) | |
tree | 4edcf81bbf3e26ae7c696f5d79b2e293baa0ecd9 /src/tools | |
parent | 6313ff8a6298d221f0ededba12d6e4a9de777c98 (diff) |
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>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/qdoc/qdocdatabase.cpp | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index 5ca8e36ef9..6312deacbf 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -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()) { |