Commit 64454418 authored by Roberto Raggi's avatar Roberto Raggi

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.
parent e8eea80c
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment