QmlJs: fix indentation in object literals

Handle properly ternary operator inside object literals

Task-number: QTCREATORBUG-7103
Change-Id: I482fb77a606f929528147c2b3939fcade77ae40f
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Benelli
2018-05-22 17:53:20 +02:00
parent d14e89f899
commit abb7d4cb53

View File

@@ -290,7 +290,7 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
if (tryInsideExpression()) if (tryInsideExpression())
break; break;
switch (kind) { switch (kind) {
case Comma: case Comma: leave(true); break;
case Delimiter: enter(expression_continuation); break; case Delimiter: enter(expression_continuation); break;
case RightBracket: case RightBracket:
case RightParenthesis: leave(); continue; case RightParenthesis: leave(); continue;
@@ -342,11 +342,11 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
if (tryInsideExpression()) if (tryInsideExpression())
break; break;
switch (kind) { switch (kind) {
case Comma: leave(); break;
case Delimiter: enter(expression_continuation); break; case Delimiter: enter(expression_continuation); break;
case RightBracket: case RightBracket:
case RightParenthesis: leave(); continue; // error recovery case RightParenthesis: leave(); continue; // error recovery
case RightBrace: leave(); continue; // so we also leave objectliteral_open case RightBrace: leave(); continue; // so we also leave objectliteral_open
case Comma: leave(); break;
} break; } break;
case bracket_element_start: case bracket_element_start: