@@ -1690,30 +1690,23 @@ function OutputStream(options) {
|
||||
|
||||
function print_property_key(self, output) {
|
||||
var key = self.key;
|
||||
if (key instanceof AST_Node) {
|
||||
output.with_square(function() {
|
||||
if (key instanceof AST_Node) return output.with_square(function() {
|
||||
key.print(output);
|
||||
});
|
||||
} else if (output.option("quote_keys")) {
|
||||
output.print_string(key);
|
||||
var quote = self.start && self.start.quote;
|
||||
if (output.option("quote_keys") || quote && output.option("keep_quoted_props")) {
|
||||
output.print_string(key, quote);
|
||||
} else if ("" + +key == key && key >= 0) {
|
||||
output.print(make_num(key));
|
||||
} else {
|
||||
var quote = self.start && self.start.quote;
|
||||
if (self.private) {
|
||||
} else if (self.private) {
|
||||
output.print_name(key);
|
||||
} else if (RESERVED_WORDS[key] ? !output.option("ie") : is_identifier_string(key)) {
|
||||
if (quote && output.option("keep_quoted_props")) {
|
||||
output.print_string(key, quote);
|
||||
} else {
|
||||
output.print_name(key);
|
||||
return key;
|
||||
}
|
||||
} else {
|
||||
output.print_string(key, quote);
|
||||
}
|
||||
}
|
||||
}
|
||||
DEFPRINT(AST_ObjectKeyVal, function(output) {
|
||||
var self = this;
|
||||
print_property_key(self, output);
|
||||
|
||||
@@ -1463,3 +1463,50 @@ issue_4888: {
|
||||
}
|
||||
expect_stdout: "object"
|
||||
}
|
||||
|
||||
issue_5093: {
|
||||
beautify = {
|
||||
keep_quoted_props: true,
|
||||
}
|
||||
input: {
|
||||
console.log({
|
||||
a: true,
|
||||
'42': "PASS",
|
||||
"null": [],
|
||||
}[6 * 7]);
|
||||
}
|
||||
expect_exact: 'console.log({a:true,"42":"PASS","null":[]}[6*7]);'
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_5093_quote_keys: {
|
||||
beautify = {
|
||||
keep_quoted_props: true,
|
||||
quote_keys: true,
|
||||
}
|
||||
input: {
|
||||
console.log({
|
||||
a: true,
|
||||
'42': "PASS",
|
||||
"null": [],
|
||||
}[6 * 7]);
|
||||
}
|
||||
expect_exact: 'console.log({"a":true,"42":"PASS","null":[]}[6*7]);'
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_5093_quote_style: {
|
||||
beautify = {
|
||||
keep_quoted_props: true,
|
||||
quote_style: 3,
|
||||
}
|
||||
input: {
|
||||
console.log({
|
||||
a: true,
|
||||
'42': "PASS",
|
||||
"null": [],
|
||||
}[6 * 7]);
|
||||
}
|
||||
expect_exact: 'console.log({a:true,\'42\':"PASS","null":[]}[6*7]);'
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user