qmljs: indent expression in if condition and indent lambda expressions

* indent expressions (like function defs) in if condition
  fixes QTCREATORBUG-7243

Change-Id: I61197317a8dcba72a45b660600711748e2e2b962
Reviewed-by: Christian Kamm <kamm@incasoftware.de>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Fawzi Mohamed
2012-11-21 11:05:03 +01:00
committed by Fawzi Mohamed
parent 9bf654743e
commit 66eb27e687
3 changed files with 22 additions and 12 deletions

View File

@@ -407,16 +407,10 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
break;
case condition_open:
if (tryInsideExpression())
break;
switch (kind) {
case RightParenthesis: turnInto(substatement); break;
case LeftParenthesis: enter(condition_paren_open); break;
} break;
// paren nesting
case condition_paren_open:
switch (kind) {
case RightParenthesis: leave(); break;
case LeftParenthesis: enter(condition_paren_open); break;
} break;
case switch_statement:
@@ -1131,7 +1125,6 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd
case signal_arglist_open:
case function_arglist_open:
case paren_open:
case condition_paren_open:
if (!lastToken)
*indentDepth = tokenPosition + 1;
else

View File

@@ -154,7 +154,6 @@ public: // must be public to make Q_GADGET introspection work
else_clause, // The else line of an if-else construct.
condition_open, // Start of a condition in 'if', 'while', entered after opening paren
condition_paren_open, // After an lparen in a condition
substatement, // The first line after a conditional or loop construct.
substatement_open, // The brace that opens a substatement block.