forked from qt-creator/qt-creator
Fix: Switch Between Method Declaration/Definition issue when has implementation in header file
Task-number: QTCREATORBUG-8393 Change-Id: Ie390e3151e6edc68287e5e0241365d128e6e2c4c Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -1120,18 +1120,20 @@ void CPPEditorWidget::switchDeclarationDefinition()
|
|||||||
foreach (const LookupItem &r, declarations) {
|
foreach (const LookupItem &r, declarations) {
|
||||||
if (Symbol *decl = r.declaration()) {
|
if (Symbol *decl = r.declaration()) {
|
||||||
if (Function *funTy = decl->type()->asFunctionType()) {
|
if (Function *funTy = decl->type()->asFunctionType()) {
|
||||||
if (funTy->isEqualTo(function) && decl != function && binding == r.binding())
|
if (funTy->isEqualTo(function)) {
|
||||||
|
if (decl != function && binding == r.binding())
|
||||||
best.prepend(decl);
|
best.prepend(decl);
|
||||||
else
|
else
|
||||||
best.append(decl);
|
best.append(decl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (! best.isEmpty())
|
if (! best.isEmpty())
|
||||||
openCppEditorAt(linkToSymbol(best.first()));
|
openCppEditorAt(linkToSymbol(best.first()));
|
||||||
|
|
||||||
} else if (lastVisibleSymbol && lastVisibleSymbol->isDeclaration() && lastVisibleSymbol->type()->isFunctionType()) {
|
} else if (lastVisibleSymbol && lastVisibleSymbol->isDeclaration() && lastVisibleSymbol->type()->isFunctionType()) {
|
||||||
if (Symbol *def = symbolFinder()->findMatchingDefinition(lastVisibleSymbol, snapshot))
|
if (Symbol *def = symbolFinder()->findMatchingDefinition(lastVisibleSymbol, snapshot, true))
|
||||||
openCppEditorAt(linkToSymbol(def));
|
openCppEditorAt(linkToSymbol(def));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,6 +158,9 @@ Symbol *SymbolFinder::findMatchingDefinition(Symbol *declaration,
|
|||||||
continue; // nothing to do
|
continue; // nothing to do
|
||||||
|
|
||||||
foreach (Function *fun, result) {
|
foreach (Function *fun, result) {
|
||||||
|
if (fun->unqualifiedName()->isDestructorNameId() != declaration->unqualifiedName()->isDestructorNameId())
|
||||||
|
continue;
|
||||||
|
|
||||||
const QList<LookupItem> declarations = context.lookup(fun->name(), fun->enclosingScope());
|
const QList<LookupItem> declarations = context.lookup(fun->name(), fun->enclosingScope());
|
||||||
if (declarations.isEmpty())
|
if (declarations.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user