From 85b73f7c24a9e85f4c4ee759faca70fce2ed6697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 16 Jan 2014 16:58:50 +0100 Subject: [PATCH] ast: fixed hang for weird loop: 'for (each_window(list,p))' --- lib/tokenlist.cpp | 4 ++-- test/testtokenize.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) 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