Fix case where a lonely var is used as computed property

This commit is contained in:
Anthony Van de Gejuchte
2016-10-24 23:35:14 +02:00
committed by Richard van Velzen
parent 5f6825f9ec
commit c2112d5886
2 changed files with 12 additions and 1 deletions

View File

@@ -1508,7 +1508,7 @@ function OutputStream(options) {
) {
self.print_property_name(self.key, self.quote, output);
} else {
if (!(self.key instanceof AST_Node) || self.key instanceof AST_Symbol) {
if (!(self.key instanceof AST_Node)) {
self.print_property_name(self.key, self.quote, output);
} else {
output.with_square(function() {

View File

@@ -491,3 +491,14 @@ allow_assignments_to_property_values: {
var foo = {123: foo = 123} = {foo: "456"};
}
}
variable_as_computed_property: {
input: {
function getLine(header) {
return {
[header]: {}
};
}
}
expect_exact: "function getLine(header){return{[header]:{}}}"
}