Tokenizer: Fixed failed unit test
This commit is contained in:
parent
8950b4bd72
commit
b6b5416b42
|
@ -3480,9 +3480,12 @@ void Tokenizer::setVarId()
|
||||||
std::string varname;
|
std::string varname;
|
||||||
Token *tok2 = tok ? tok->next() : 0;
|
Token *tok2 = tok ? tok->next() : 0;
|
||||||
while (tok2) {
|
while (tok2) {
|
||||||
if (tok2->isName() && tok2->str() != "const")
|
if (tok2->isName()) {
|
||||||
varname = tok2->str();
|
if (tok2->str() == "const")
|
||||||
else if (tok2->str() != "*" && tok2->str() != "&")
|
varname.clear();
|
||||||
|
else
|
||||||
|
varname = tok2->str();
|
||||||
|
} else if (tok2->str() != "*" && tok2->str() != "&")
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// a type can't have varid
|
// a type can't have varid
|
||||||
|
|
|
@ -2957,10 +2957,19 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void varid39() {
|
void varid39() {
|
||||||
const std::string code = "void f(FOO::BAR const);\n";
|
// const..
|
||||||
ASSERT_EQUALS("\n\n##file 0\n"
|
{
|
||||||
"1: void f ( FOO :: BAR const ) ;\n",
|
const std::string code = "void f(FOO::BAR const);\n";
|
||||||
tokenizeDebugListing(code));
|
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() {
|
void varidFunctionCall1() {
|
||||||
|
|
Loading…
Reference in New Issue