diff --git a/lib/6to5/generators/types.js b/lib/6to5/generators/types.js index 99d0baf6b5..0a26ff2174 100644 --- a/lib/6to5/generators/types.js +++ b/lib/6to5/generators/types.js @@ -22,7 +22,7 @@ exports.ObjectPattern = function (node, print) { this.push(" "); } else { this.newline(); - this.printJoin(print, props, ",\n", true); + this.printJoin(print, props, ",\n", { indent: true }); this.newline(); } @@ -34,9 +34,17 @@ exports.ObjectPattern = function (node, print) { exports.Property = function (node, print) { if (node.method || node.kind === "get" || node.kind === "set") { - throw new Error("Property"); + this._method(node, print); } else { - print(node.key); + if (node.computed) { + this.push("["); + print(node.key); + this.push("]"); + } else { + print(node.key); + if (node.shorthand) return; + } + this.push(": "); print(node.value); }