Variable Id: fixed issue with function call. Ticket: #1848

This commit is contained in:
Daniel Marjamäki 2010-07-12 20:18:03 +02:00
parent cba711f293
commit 61150498c4
2 changed files with 25 additions and 1 deletions

View File

@ -2667,7 +2667,7 @@ void Tokenizer::setVarId()
continue;
if (tok->strAt(-1) == "return")
continue;
if (!Token::Match(tok->tokAt(5), "const|{|;"))
if (!Token::Match(tok->tokAt(5), "const|{"))
continue;
}

View File

@ -153,6 +153,7 @@ private:
TEST_CASE(varidclass5);
TEST_CASE(varidclass6);
TEST_CASE(varidclass7);
TEST_CASE(varidclass8);
TEST_CASE(file1);
TEST_CASE(file2);
@ -2650,6 +2651,29 @@ private:
TODO_ASSERT_EQUALS(expected, actual);
}
void varidclass8()
{
const std::string code("class Fred {\n"
"public:\n"
" void foo(int d) {\n"
" int i = bar(x * d);\n"
" }\n"
" int x;\n"
"}\n");
const std::string expected("\n\n##file 0\n"
"1: class Fred {\n"
"2: public:\n"
"3: void foo ( int d@1 ) {\n"
"4: int i@2 ; i@2 = bar ( x * d@1 ) ;\n"
"5: }\n"
"6: int x@3 ;\n"
"7: }\n");
ASSERT_EQUALS(expected, tokenizeDebugListing(code));
}
void file1()
{
const char code[] = "a1\n"