Commit 41320112 authored by Przemyslaw Gorszkowski's avatar Przemyslaw Gorszkowski Committed by Nikolai Kosjar

CppEditor:follow symbol:cursor is at the end of virtual function name

If the cursor is at the end of the virtual function name but before '('
then scope is a function.

Task-number: QTCREATORBUG-10294

Change-Id: I83699d3fa33bc0f33d6524fa6d84cfc2b9e71f85
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 542cee75
...@@ -119,7 +119,7 @@ bool VirtualFunctionHelper::canLookupVirtualFunctionOverrides(Function *function ...@@ -119,7 +119,7 @@ bool VirtualFunctionHelper::canLookupVirtualFunctionOverrides(Function *function
{ {
m_function = function; m_function = function;
if (!m_function || !m_baseExpressionAST || !m_expressionDocument || !m_document || !m_scope if (!m_function || !m_baseExpressionAST || !m_expressionDocument || !m_document || !m_scope
|| m_scope->isClass() || m_snapshot.isEmpty()) { || m_scope->isClass() || m_scope->isFunction() || m_snapshot.isEmpty()) {
return false; return false;
} }
......
...@@ -1314,6 +1314,14 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall_data() ...@@ -1314,6 +1314,14 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall_data()
<< (OverrideItemList() << (OverrideItemList()
<< OverrideItem(QLatin1String("Base::virt"), 1) << OverrideItem(QLatin1String("Base::virt"), 1)
<< OverrideItem(QLatin1String("Derived::virt"), 2)); << OverrideItem(QLatin1String("Derived::virt"), 2));
QTest::newRow("QTCREATORBUG-10294_cursorIsAtTheEndOfVirtualFunctionName") << _(
"struct Base { virtual void virt() {} };\n"
"struct Derived : Base { void virt() {} };\n"
"void client(Base *b) { b->virt$@(); }\n")
<< (OverrideItemList()
<< OverrideItem(QLatin1String("Base::virt"), 1)
<< OverrideItem(QLatin1String("Derived::virt"), 2));
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall() void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall()
......
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