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:
raidsan
2012-12-07 18:41:09 +08:00
committed by Erik Verbruggen
parent 352f6d6c4b
commit 45ec1bbe4a
2 changed files with 10 additions and 5 deletions

View File

@@ -1120,10 +1120,12 @@ void CPPEditorWidget::switchDeclarationDefinition()
foreach (const LookupItem &r, declarations) {
if (Symbol *decl = r.declaration()) {
if (Function *funTy = decl->type()->asFunctionType()) {
if (funTy->isEqualTo(function) && decl != function && binding == r.binding())
best.prepend(decl);
else
best.append(decl);
if (funTy->isEqualTo(function)) {
if (decl != function && binding == r.binding())
best.prepend(decl);
else
best.append(decl);
}
}
}
}
@@ -1131,7 +1133,7 @@ void CPPEditorWidget::switchDeclarationDefinition()
openCppEditorAt(linkToSymbol(best.first()));
} 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));
}
}