diff --git a/lib/6to5/generation/generators/statements.js b/lib/6to5/generation/generators/statements.js index 0ccd4908e2..fd2ddba1ec 100644 --- a/lib/6to5/generation/generators/statements.js +++ b/lib/6to5/generation/generators/statements.js @@ -157,7 +157,22 @@ exports.DebuggerStatement = function () { exports.VariableDeclaration = function (node, print, parent) { this.push(node.kind + " "); - print.join(node.declarations, { separator: ",\n" + this.getIndent(2) }); + var hasInits = false; + for (var i in node.declarations) { + if (node.declarations[i].init) { + hasInits = true; + break; + } + } + + var sep = ","; + if (hasInits) { + sep += "\n" + this.getIndent(2); + } else { + sep += " "; + } + + print.join(node.declarations, { separator: sep }); if (!t.isFor(parent)) { this.semicolon();