diff --git a/src/libs/qmljs/qmljsreformatter.cpp b/src/libs/qmljs/qmljsreformatter.cpp index bb2a0520721..c83ee11a357 100644 --- a/src/libs/qmljs/qmljsreformatter.cpp +++ b/src/libs/qmljs/qmljsreformatter.cpp @@ -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(", "); } diff --git a/tests/auto/qml/reformatter/jssyntax.js b/tests/auto/qml/reformatter/jssyntax.js index 2d46f597c80..34166825aaf 100644 --- a/tests/auto/qml/reformatter/jssyntax.js +++ b/tests/auto/qml/reformatter/jssyntax.js @@ -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]