forked from qt-creator/qt-creator
qmljsreformatter: support nullish coalescing
qmljsscanner did interpret ?? and ?. as a single ? and thus as the start of a ternary operator, breaking reformatting. Fixes: QTCREATORBUG-27344 Change-Id: I0429d20aed0196743f1c20e6ceac11351d5a7a3b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -957,10 +957,10 @@ protected:
|
||||
accept(ast->left);
|
||||
|
||||
// in general, avoid splitting at the operator
|
||||
// but && and || are ok
|
||||
// but && || and ?? are ok
|
||||
qreal splitBadness = 30;
|
||||
if (ast->op == QSOperator::And
|
||||
|| ast->op == QSOperator::Or)
|
||||
|| ast->op == QSOperator::Or || ast->op == QSOperator::Coalesce)
|
||||
splitBadness = 0;
|
||||
addPossibleSplit(splitBadness);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user