Fixed: "Follow symbol" on constructor or destructor always jumps to class definition

Task-number: QTCREATORBUG-1776
This commit is contained in:
Roberto Raggi
2010-07-05 13:34:27 +02:00
parent d209bd72db
commit 76ebb46479
2 changed files with 18 additions and 13 deletions

View File

@@ -1238,7 +1238,20 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor,
const QList<LookupItem> resolvedSymbols = typeOfExpression(expression, scope, TypeOfExpression::Preprocess);
if (!resolvedSymbols.isEmpty()) {
const LookupItem result = skipForwardDeclarations(resolvedSymbols);
LookupItem result = skipForwardDeclarations(resolvedSymbols);
foreach (const LookupItem &r, resolvedSymbols) {
if (Symbol *d = r.declaration()) {
if (d->isDeclaration() || d->isFunction()) {
if (file()->fileName() == QString::fromUtf8(d->fileName(), d->fileNameLength())) {
if (unsigned(line) == d->line() && unsigned(column) >= d->column()) { // ### TODO: check the end
result = r; // take the symbol under cursor.
break;
}
}
}
}
}
if (Symbol *symbol = result.declaration()) {
Symbol *def = 0;