diff --git a/src/libs/qmljs/qmljsreformatter.cpp b/src/libs/qmljs/qmljsreformatter.cpp index c78f52f5b8f..d582c3de94f 100644 --- a/src/libs/qmljs/qmljsreformatter.cpp +++ b/src/libs/qmljs/qmljsreformatter.cpp @@ -687,7 +687,9 @@ protected: for (PropertyAssignmentList *it = ast; it; it = it->next) { PropertyNameAndValue *assignment = AST::cast(it->assignment); if (assignment) { + out("\""); accept(assignment->name); + out("\""); out(": ", assignment->colonToken); accept(assignment->value); if (it->next) { diff --git a/tests/auto/qml/reformatter/objectliteral.js b/tests/auto/qml/reformatter/objectliteral.js index 9c8bfc46f1d..37f68633746 100644 --- a/tests/auto/qml/reformatter/objectliteral.js +++ b/tests/auto/qml/reformatter/objectliteral.js @@ -1,12 +1,12 @@ var x = { - x: 12, - y: { - x: 12, - y: "abc", - z: function (x) { + "x": 12, + "y": { + "x": 12, + "y": "abc", + "z": function (x) { return a }, - abc: 15 + "abc": 15 }, - z: 12 + "z": 12 }