Tokenizer: Fixed failed unit test

This commit is contained in:
Daniel Marjamaki 2011-11-02 20:42:38 +01:00
parent 8950b4bd72
commit b6b5416b42
2 changed files with 19 additions and 7 deletions

View File

@ -3480,9 +3480,12 @@ void Tokenizer::setVarId()
std::string varname;
Token *tok2 = tok ? tok->next() : 0;
while (tok2) {
if (tok2->isName() && tok2->str() != "const")
if (tok2->isName()) {
if (tok2->str() == "const")
varname.clear();
else
varname = tok2->str();
else if (tok2->str() != "*" && tok2->str() != "&")
} else if (tok2->str() != "*" && tok2->str() != "&")
break;
// a type can't have varid

View File

@ -2957,11 +2957,20 @@ private:
}
void varid39() {
// const..
{
const std::string code = "void f(FOO::BAR const);\n";
ASSERT_EQUALS("\n\n##file 0\n"
"1: void f ( FOO :: BAR const ) ;\n",
tokenizeDebugListing(code));
}
{
const std::string code = "static int const SZ = 22;\n";
ASSERT_EQUALS("\n\n##file 0\n"
"1: static int const SZ@1 = 22 ;\n",
tokenizeDebugListing(code));
}
}
void varidFunctionCall1() {
const std::string code("void f() {\n"