Tokenizer: setVarId improved to handle declaration at the first token
This commit is contained in:
parent
27c0f786bc
commit
d0af67a1b1
|
@ -468,8 +468,11 @@ void Tokenizer::setVarId()
|
||||||
unsigned int _varId = 0;
|
unsigned int _varId = 0;
|
||||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
for (Token *tok = _tokens; tok; tok = tok->next())
|
||||||
{
|
{
|
||||||
if (!(firstMatch = Token::Match(tok, "[;{}(] %type% *| %var%"))
|
if ( tok != _tokens && !Token::Match(tok, "[;{}(]") )
|
||||||
&& !Token::Match(tok, "[;{}(] %type% %type% *| %var%"))
|
continue;
|
||||||
|
|
||||||
|
if (!(firstMatch = Token::Match(tok->next(), "%type% *| %var%"))
|
||||||
|
&& !Token::Match(tok->next(), "%type% %type% *| %var%"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Determine name of declared variable..
|
// Determine name of declared variable..
|
||||||
|
|
|
@ -67,7 +67,7 @@ private:
|
||||||
|
|
||||||
TEST_CASE(varid1);
|
TEST_CASE(varid1);
|
||||||
TEST_CASE(varid2);
|
TEST_CASE(varid2);
|
||||||
// TODO TEST_CASE(varid3);
|
TEST_CASE(varid3);
|
||||||
|
|
||||||
TEST_CASE(file1);
|
TEST_CASE(file1);
|
||||||
TEST_CASE(file2);
|
TEST_CASE(file2);
|
||||||
|
|
Loading…
Reference in New Issue