diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 7649781e6..69c597adf 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -699,14 +699,14 @@ void TokenList::createAst() init1 = tok2; std::stack operands; compileExpression(tok2, operands); - if (tok2->str() == ";") + if (tok2->str() == ";" || tok2->str() == ")") break; init1 = 0; } tok2 = tok2->next(); } if (!tok2 || tok2->str() != ";") { - tok = tok->next(); + tok = tok2; continue; } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 732c95d91..e6ee5ec06 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -10103,6 +10103,7 @@ private: ASSERT_EQUALS("for;;(", testAst("for(;;)")); ASSERT_EQUALS("fora0=a8