Fixed #2339 (Tokenizer::setVarId : Wrong handling of 'int gr = id - (TLFPressProperties::OIL_FLUID * nb);')

This commit is contained in:
Daniel Marjamäki 2010-12-25 12:40:44 +01:00
parent 6f8f0e1aa1
commit 10ee43790d
2 changed files with 23 additions and 0 deletions

View File

@ -3038,6 +3038,11 @@ void Tokenizer::setVarId()
{
continue;
}
if (tok->str() == "(" &&
tok->previous() &&
!tok->previous()->isName() &&
tok->strAt(-2) != "operator")
continue;
tok = tok->next();
}

View File

@ -161,6 +161,7 @@ private:
TEST_CASE(varid27); // Ticket #2280 (same name for namespace and variable)
TEST_CASE(varidFunctionCall1);
TEST_CASE(varidFunctionCall2);
TEST_CASE(varidFunctionCall3);
TEST_CASE(varidStl);
TEST_CASE(varid_delete);
TEST_CASE(varid_functions);
@ -2614,6 +2615,23 @@ private:
ASSERT_EQUALS(expected1+"@2"+expected2, tokenizeDebugListing(code));
}
void varidFunctionCall3()
{
// Ticket #2339
const std::string code("void f() {\n"
" int a = 0;\n"
" int b = c - (foo::bar * a);\n"
"}");
const std::string expected("\n\n##file 0\n"
"1: void f ( ) {\n"
"2: int a@1 ; a@1 = 0 ;\n"
"3: int b@2 ; b@2 = c - ( foo :: bar * a@1 ) ;\n"
"4: }\n");
ASSERT_EQUALS(expected, tokenizeDebugListing(code));
}
void varidStl()
{