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
|
QList<Macro> definedMacros() const
|
||||||
{ return _definedMacros; }
|
{ return _definedMacros; }
|
||||||
|
|
||||||
Symbol *lastVisibleSymbolAt(unsigned line, unsigned column) const;
|
Symbol *lastVisibleSymbolAt(unsigned line, unsigned column = 0) const;
|
||||||
Scope *scopeAt(unsigned line, unsigned column);
|
Scope *scopeAt(unsigned line, unsigned column = 0);
|
||||||
|
|
||||||
QByteArray source() const;
|
QByteArray source() const;
|
||||||
void setSource(const QByteArray &source);
|
void setSource(const QByteArray &source);
|
||||||
|
|||||||
@@ -1074,19 +1074,13 @@ void CPPEditor::switchDeclarationDefinition()
|
|||||||
int line = 0, positionInBlock = 0;
|
int line = 0, positionInBlock = 0;
|
||||||
convertPosition(position(), &line, &positionInBlock);
|
convertPosition(position(), &line, &positionInBlock);
|
||||||
|
|
||||||
Scope *scope = thisDocument->scopeAt(line, positionInBlock + 1);
|
|
||||||
Symbol *lastVisibleSymbol = thisDocument->lastVisibleSymbolAt(line, positionInBlock + 1);
|
Symbol *lastVisibleSymbol = thisDocument->lastVisibleSymbolAt(line, positionInBlock + 1);
|
||||||
|
if (! lastVisibleSymbol)
|
||||||
|
return;
|
||||||
|
|
||||||
Scope *functionScope = 0;
|
Function *functionScope = lastVisibleSymbol->asFunction();
|
||||||
if (scope->isFunction())
|
if (! functionScope)
|
||||||
functionScope = scope;
|
functionScope = lastVisibleSymbol->enclosingFunction();
|
||||||
else
|
|
||||||
functionScope = scope->enclosingFunction();
|
|
||||||
|
|
||||||
if (! functionScope && lastVisibleSymbol) {
|
|
||||||
if (Function *def = lastVisibleSymbol->asFunction())
|
|
||||||
functionScope = def;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (functionScope) {
|
if (functionScope) {
|
||||||
LookupContext context(thisDocument, snapshot);
|
LookupContext context(thisDocument, snapshot);
|
||||||
|
|||||||
Reference in New Issue
Block a user