C++: nested class in function

Case when nested class declaration contains object name for this class.
Example:
void fun()
{
    struct S
    {
        int i;
    } s;
    s.i;
}

Fixes:
* highlighting
* completion
* tests

Task-number: QTCREATORBUG-11710
Change-Id: I32e234f57655c388a87a199edc8be750d7bf823f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Przemyslaw Gorszkowski
2014-03-14 11:39:11 +01:00
committed by Nikolai Kosjar
parent 46c083c2eb
commit e3f5977311
3 changed files with 45 additions and 2 deletions

View File

@@ -1441,6 +1441,19 @@ void CppToolsPlugin::test_completion_data()
<< QLatin1String("A")
<< QLatin1String("a"));
QTest::newRow("nested_class_declaration_with_object_name_inside_function") << _(
"int foo()\n"
"{\n"
" struct Nested\n"
" {\n"
" int i;\n"
" } n;\n"
" @;\n"
"}\n"
) << _("n.") << (QStringList()
<< QLatin1String("Nested")
<< QLatin1String("i"));
QTest::newRow("nested_anonymous_class_QTCREATORBUG10876_1") << _(
"struct EnclosingStruct\n"
"{\n"