Fixed ticket #532 (Tokenizer: set varId for types which have comma in template parameter)

http://sourceforge.net/apps/trac/cppcheck/ticket/532
This commit is contained in:
Slava Semushin 2009-07-31 00:25:26 +07:00
parent 12ca70fe5a
commit 681b836389
2 changed files with 5 additions and 3 deletions

View File

@ -759,7 +759,7 @@ void Tokenizer::setVarId()
if (Token::simpleMatch(tok2, "std ::"))
tok2 = tok2->tokAt(2);
while (tok2 && (tok2->isName() || tok2->str() == "*"))
while (tok2 && (tok2->isName() || tok2->str() == "*" || tok2->str() == ","))
tok2 = tok2->next();
if (Token::Match(tok2, "> %var%"))

View File

@ -1274,7 +1274,8 @@ private:
{
const std::string code("list<int> ints;\n"
"list<int>::iterator it;\n"
"std::vector<std::string> dirs;\n");
"std::vector<std::string> dirs;\n"
"std::map<int, int> coords;\n");
// tokenize..
Tokenizer tokenizer;
@ -1287,7 +1288,8 @@ private:
const std::string expected("\n\n##file 0\n"
"1: list < int > ints@1 ;\n"
"2: list < int > :: iterator it@2 ;\n"
"3: std :: vector < std :: string > dirs@3 ;\n");
"3: std :: vector < std :: string > dirs@3 ;\n"
"4: std :: map < int , int > coords@4 ;\n");
ASSERT_EQUALS(expected, actual);
}