forked from qt-creator/qt-creator
C++: Fix off-by-one in scopeAt.
The only Scope that set the end offset to *before* the last token was ObjCClassDeclaration. Change-Id: Icbdb5bcdd72d96087ac586ad51510fed74a633eb Reviewed-on: http://codereview.qt.nokia.com/2820 Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
2
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
2
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
@@ -2296,7 +2296,7 @@ bool Bind::visit(ObjCClassDeclarationAST *ast)
|
|||||||
_scope->addMember(klass);
|
_scope->addMember(klass);
|
||||||
|
|
||||||
klass->setStartOffset(calculateScopeStart(ast));
|
klass->setStartOffset(calculateScopeStart(ast));
|
||||||
klass->setEndOffset(tokenAt(ast->lastToken() - 1).begin());
|
klass->setEndOffset(tokenAt(ast->lastToken() - 1).end());
|
||||||
|
|
||||||
if (ast->interface_token)
|
if (ast->interface_token)
|
||||||
klass->setInterface(true);
|
klass->setInterface(true);
|
||||||
|
@@ -142,7 +142,7 @@ protected:
|
|||||||
unsigned endLine, endColumn;
|
unsigned endLine, endColumn;
|
||||||
_unit->getPosition(scope->endOffset(), &endLine, &endColumn);
|
_unit->getPosition(scope->endOffset(), &endLine, &endColumn);
|
||||||
|
|
||||||
if (_line < endLine || (_line == endLine && _column <= endColumn))
|
if (_line < endLine || (_line == endLine && _column < endColumn))
|
||||||
_scope = scope;
|
_scope = scope;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user