QmlJS indenter: Fix hang when using 'else (a==a) {}'.

Change-Id: Id7b8fba6707b1eaabf8065854f357cf600c809c5
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
Christian Kamm
2011-10-19 09:21:48 +02:00
parent 3ede0687ba
commit 567e68a42a
2 changed files with 23 additions and 2 deletions

View File

@@ -255,8 +255,13 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
case expression_or_label:
switch (kind) {
case Colon: turnInto(labelled_statement); break;
default: enter(expression); continue;
case Colon: turnInto(labelled_statement); break;
// propagate 'leave' from expression state
case RightBracket:
case RightParenthesis: leave(); continue;
default: enter(expression); continue;
} break;
case ternary_op:
@@ -756,6 +761,7 @@ bool CodeFormatter::tryStatement()
case Function:
case Number:
case String:
case LeftParenthesis:
enter(expression);
// look at the token again
m_tokenIndex -= 1;