Files
qt-creator/tests/auto/qml/reformatter/objectliteral.js
Marco Benelli a874cf581d Qml/js reformatter: use quotes in objects literals
The reformatter used to remove the quotes that wraps the property name
in object literals.  This causes problem when the name is not a
valid identifier, resulting in that valid code become invalid after
reformatting.
This patch forces wrapping of property's name in quotes: in this way,
the reformatted code is consistent and it never get invalidated.

However the resulting formatted code is not consisted with the one
formatted by previous versions.

Task-number: QTCREATORBUG-17455
Change-Id: I1e361102819055de210d6c81020f204c08aaa253
Reviewed-by: Markus Maier <markus.maier.sw@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-04-05 06:50:03 +00:00

13 lines
170 B
JavaScript

var x = {
"x": 12,
"y": {
"x": 12,
"y": "abc",
"z": function (x) {
return a
},
"abc": 15
},
"z": 12
}