forked from qt-creator/qt-creator
qmljs: preserve default arguments when reformatting QML
Fixes: QTCREATORBUG-23009 Change-Id: I9949fe26a91a063c4804fddcca4e26d14bc5cd61 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
@@ -1023,7 +1023,7 @@ protected:
|
||||
}
|
||||
out(ast->identifierToken);
|
||||
if (ast->initializer) {
|
||||
if (ast->isVariableDeclaration())
|
||||
if (ast->isVariableDeclaration() || ast->type == PatternElement::Binding)
|
||||
out(" = ");
|
||||
accept(ast->initializer);
|
||||
}
|
||||
@@ -1394,7 +1394,7 @@ protected:
|
||||
bool visit(FormalParameterList *ast) override
|
||||
{
|
||||
for (FormalParameterList *it = ast; it; it = it->next) {
|
||||
out(it->element->bindingIdentifier.toString()); // TODO
|
||||
accept(it->element);
|
||||
if (it->next)
|
||||
out(", ");
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ function foo(a, b) {
|
||||
x += 4
|
||||
}
|
||||
|
||||
var foo = function (a, b) {}
|
||||
var foo = function (a, b = 0) {}
|
||||
|
||||
function spread() {
|
||||
iterableObj = [1, 2]
|
||||
|
Reference in New Issue
Block a user