Restore the old behaviour when switching between function declaration/definition symbols.

That is, we don't look at the column position anymore when searching
the function under cursor.
This commit is contained in:
Roberto Raggi
2010-08-17 14:30:11 +02:00
parent e8eea80c3f
commit 644544185f
2 changed files with 7 additions and 13 deletions

View File

@@ -91,8 +91,8 @@ public:
QList<Macro> definedMacros() const
{ return _definedMacros; }
Symbol *lastVisibleSymbolAt(unsigned line, unsigned column) const;
Scope *scopeAt(unsigned line, unsigned column);
Symbol *lastVisibleSymbolAt(unsigned line, unsigned column = 0) const;
Scope *scopeAt(unsigned line, unsigned column = 0);
QByteArray source() const;
void setSource(const QByteArray &source);

View File

@@ -1074,19 +1074,13 @@ void CPPEditor::switchDeclarationDefinition()
int line = 0, positionInBlock = 0;
convertPosition(position(), &line, &positionInBlock);
Scope *scope = thisDocument->scopeAt(line, positionInBlock + 1);
Symbol *lastVisibleSymbol = thisDocument->lastVisibleSymbolAt(line, positionInBlock + 1);
if (! lastVisibleSymbol)
return;
Scope *functionScope = 0;
if (scope->isFunction())
functionScope = scope;
else
functionScope = scope->enclosingFunction();
if (! functionScope && lastVisibleSymbol) {
if (Function *def = lastVisibleSymbol->asFunction())
functionScope = def;
}
Function *functionScope = lastVisibleSymbol->asFunction();
if (! functionScope)
functionScope = lastVisibleSymbol->enclosingFunction();
if (functionScope) {
LookupContext context(thisDocument, snapshot);