Commit 4c6ad5e3 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

C++: Fix completion for enum inside member functions

Task-number: QTCREATORBUG-13757
Change-Id: I283306b0c8348ee82e8e9bf47d404c1ecd473fde
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
parent fb396ffb
......@@ -824,13 +824,15 @@ ClassOrNamespace *ClassOrNamespace::findBlock(Block *block)
{
flush();
QHash<Block *, ClassOrNamespace *>::const_iterator citBlock = _blocks.find(block);
if (citBlock != _blocks.end())
return citBlock.value();
for (citBlock = _blocks.begin(); citBlock != _blocks.end(); ++citBlock) {
if (ClassOrNamespace *foundNestedBlock = citBlock.value()->findBlock(block))
return foundNestedBlock;
for (ClassOrNamespace *binding = this; binding; binding = binding->_parent) {
QHash<Block *, ClassOrNamespace *>::const_iterator citBlock = binding->_blocks.find(block);
if (citBlock != binding->_blocks.end())
return citBlock.value();
for (citBlock = binding->_blocks.begin(); citBlock != binding->_blocks.end(); ++citBlock) {
if (ClassOrNamespace *foundNestedBlock = citBlock.value()->findBlock(block))
return foundNestedBlock;
}
}
return 0;
......
......@@ -313,9 +313,6 @@ void CppToolsPlugin::test_completion()
QEXPECT_FAIL("enum_in_function_in_struct_in_function", "QTCREATORBUG-13757", Abort);
QEXPECT_FAIL("enum_in_function_in_struct_in_function_cxx11", "QTCREATORBUG-13757", Abort);
QEXPECT_FAIL("enum_in_function_in_struct_in_function_anon", "QTCREATORBUG-13757", Abort);
QEXPECT_FAIL("enum_inside_member_function", "QTCREATORBUG-13757", Abort);
QEXPECT_FAIL("enum_inside_member_function_cxx11", "QTCREATORBUG-13757", Abort);
QEXPECT_FAIL("enum_inside_member_function_anon", "QTCREATORBUG-13757", Abort);
QEXPECT_FAIL("enum_in_class_accessed_in_member_func_cxx11", "QTCREATORBUG-13757", Abort);
QEXPECT_FAIL("enum_in_class_accessed_in_member_func_inline_cxx11", "QTCREATORBUG-13757", Abort);
QCOMPARE(actualCompletions, expectedCompletions);
......
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