parent
9c184462ad
commit
5b4c95f229
|
@ -4597,7 +4597,8 @@ void Tokenizer::setVarIdPass1()
|
|||
continue;
|
||||
|
||||
if (tok3->isLiteral() ||
|
||||
(tok3->isName() && (variableMap.hasVariable(tok3->str()) || (tok3->strAt(-1) == "(" && Token::simpleMatch(tok3->next(), "(")))) ||
|
||||
(tok3->isName() && (variableMap.hasVariable(tok3->str()) ||
|
||||
(tok3->strAt(-1) == "(" && Token::simpleMatch(tok3->next(), "(") && !Token::simpleMatch(tok3->linkAt(1)->next(), "(")))) ||
|
||||
tok3->isOp() ||
|
||||
tok3->str() == "(" ||
|
||||
notstart.find(tok3->str()) != notstart.end()) {
|
||||
|
|
|
@ -1197,11 +1197,22 @@ private:
|
|||
}
|
||||
|
||||
void varid66() {
|
||||
const char code[] = "std::string g();\n"
|
||||
"const std::string s(g() + \"abc\");\n";
|
||||
const char expected[] = "1: std :: string g ( ) ;\n"
|
||||
"2: const std :: string s@1 ( g ( ) + \"abc\" ) ;\n";
|
||||
ASSERT_EQUALS(expected, tokenize(code));
|
||||
{
|
||||
const char code[] = "std::string g();\n"
|
||||
"const std::string s(g() + \"abc\");\n";
|
||||
const char expected[] = "1: std :: string g ( ) ;\n"
|
||||
"2: const std :: string s@1 ( g ( ) + \"abc\" ) ;\n";
|
||||
ASSERT_EQUALS(expected, tokenize(code));
|
||||
}
|
||||
{
|
||||
const char code[] = "enum E {};\n"
|
||||
"typedef E(*fp_t)();\n"
|
||||
"E f(fp_t fp);\n";
|
||||
const char expected[] = "1: enum E { } ;\n"
|
||||
"2:\n"
|
||||
"3: E f ( E ( * fp@1 ) ( ) ) ;\n";
|
||||
ASSERT_EQUALS(expected, tokenize(code));
|
||||
}
|
||||
}
|
||||
|
||||
void varid_for_1() {
|
||||
|
|
Loading…
Reference in New Issue