Skip to content

Commit 4bfbb5a

Browse files
Update tokenize.cpp
1 parent 107d10e commit 4bfbb5a

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

lib/tokenize.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7450,9 +7450,9 @@ void Tokenizer::simplifyVarDecl(Token * tokBegin, const Token * const tokEnd, co
74507450
else if (Token::Match(varName, "%name% [")) {
74517451
tok2 = varName->next();
74527452

7453-
while (Token::Match(tok2->link(), "] ,|=|["))
7453+
while (Token::Match(tok2->link(), "] [,=[{]"))
74547454
tok2 = tok2->link()->next();
7455-
if (!Token::Match(tok2, "=|,"))
7455+
if (!Token::Match(tok2, "[=,{]"))
74567456
tok2 = nullptr;
74577457
if (tok2 && tok2->str() == "=") {
74587458
while (tok2 && tok2->str() != "," && tok2->str() != ";") {
@@ -7522,9 +7522,11 @@ void Tokenizer::simplifyVarDecl(Token * tokBegin, const Token * const tokEnd, co
75227522
varTok = varTok->next();
75237523
if (!varTok)
75247524
syntaxError(tok2); // invalid code
7525-
TokenList::insertTokens(eq, varTok, 2);
7526-
eq->str(";");
7527-
eq->isSplittedVarDeclEq(true);
7525+
if (eq->str() == "=") {
7526+
TokenList::insertTokens(eq, varTok, 2);
7527+
eq->str(";");
7528+
eq->isSplittedVarDeclEq(true);
7529+
}
75287530

75297531
// "= x, " => "= x; type "
75307532
if (tok2->str() == ",") {

0 commit comments

Comments
 (0)