forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user