Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90437d262b | ||
|
|
4aba7ec192 | ||
|
|
a924c9c218 | ||
|
|
a2ed0ea9c5 | ||
|
|
c5cd729c3d | ||
|
|
b065d43a6d | ||
|
|
281003c7bd | ||
|
|
6650336c64 | ||
|
|
f904734695 |
@@ -11,6 +11,12 @@
|
||||
|
||||
_Note: Gaps between patch versions are faulty/broken releases._
|
||||
|
||||
## 2.7.4
|
||||
|
||||
* **Polish**
|
||||
* Inherit assignments from their declaration in destructuring.
|
||||
* Properly align multi-declarator variable declarations.
|
||||
|
||||
## 2.7.3
|
||||
|
||||
* **Polish**
|
||||
|
||||
@@ -62,7 +62,7 @@ exports.CallExpression = function (node, print) {
|
||||
|
||||
var separator = ",";
|
||||
|
||||
if (node._prettyPrint) {
|
||||
if (node._prettyCall) {
|
||||
separator += "\n";
|
||||
this.newline();
|
||||
this.indent();
|
||||
@@ -74,7 +74,7 @@ exports.CallExpression = function (node, print) {
|
||||
separator: separator
|
||||
});
|
||||
|
||||
if (node._prettyPrint) {
|
||||
if (node._prettyCall) {
|
||||
this.newline();
|
||||
this.dedent();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
var t = require("../../types");
|
||||
var util = require("../../util");
|
||||
var t = require("../../types");
|
||||
|
||||
exports.WithStatement = function (node, print) {
|
||||
this.keyword("with");
|
||||
@@ -157,7 +158,24 @@ exports.DebuggerStatement = function () {
|
||||
exports.VariableDeclaration = function (node, print, parent) {
|
||||
this.push(node.kind + " ");
|
||||
|
||||
print.join(node.declarations, { separator: ", " });
|
||||
var inits = 0;
|
||||
var noInits = 0;
|
||||
for (var i in node.declarations) {
|
||||
if (node.declarations[i].init) {
|
||||
inits++;
|
||||
} else {
|
||||
noInits++;
|
||||
}
|
||||
}
|
||||
|
||||
var sep = ",";
|
||||
if (inits > noInits) { // more inits than noinits
|
||||
sep += "\n" + util.repeat(node.kind.length + 1);
|
||||
} else {
|
||||
sep += " ";
|
||||
}
|
||||
|
||||
print.join(node.declarations, { separator: sep });
|
||||
|
||||
if (!t.isFor(parent)) {
|
||||
this.semicolon();
|
||||
|
||||
@@ -300,10 +300,17 @@ exports.VariableDeclaration = function (node, parent, file, scope) {
|
||||
file: file,
|
||||
scope: scope
|
||||
};
|
||||
|
||||
if (t.isPattern(pattern) && patternId) {
|
||||
pushPattern(opts);
|
||||
|
||||
if (+i !== node.declarations.length - 1) {
|
||||
// we aren't the last declarator so let's just make the
|
||||
// last transformed node inherit from us
|
||||
t.inherits(nodes[nodes.length - 1], declar);
|
||||
}
|
||||
} else {
|
||||
nodes.push(buildVariableAssign(opts, declar.id, declar.init));
|
||||
nodes.push(t.inherits(buildVariableAssign(opts, declar.id, declar.init), declar));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ exports.XJSElement = {
|
||||
}
|
||||
|
||||
if (callExpr.arguments.length >= 3) {
|
||||
callExpr._prettyPrint = true;
|
||||
callExpr._prettyCall = true;
|
||||
}
|
||||
|
||||
return t.inherits(callExpr, node);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "6to5",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "2.7.3",
|
||||
"version": "2.7.4",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://github.com/6to5/6to5",
|
||||
"repository": {
|
||||
|
||||
@@ -7,4 +7,5 @@ var test = {
|
||||
* Inside bracket init
|
||||
*/
|
||||
"b"]: "2"
|
||||
}, ok = 42;
|
||||
},
|
||||
ok = 42;
|
||||
|
||||
@@ -3,6 +3,7 @@ function test() {
|
||||
// Leading to VariableDeclarator
|
||||
// Leading to VariableDeclarator
|
||||
i = 20,
|
||||
|
||||
// Leading to VariableDeclarator
|
||||
// Leading to VariableDeclarator
|
||||
j = 20;
|
||||
|
||||
@@ -5,6 +5,7 @@ function test() {
|
||||
* Leading to VariableDeclarator
|
||||
*/
|
||||
i = 20,
|
||||
|
||||
/*
|
||||
* Leading to VariableDeclarator
|
||||
* Leading to VariableDeclarator
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
function* foo() {
|
||||
var a = yield wat(), b = 2;
|
||||
var a = yield wat(),
|
||||
b = 2;
|
||||
var c = yield a = b;
|
||||
yield a, yield b;
|
||||
yield a = b;
|
||||
|
||||
@@ -8,6 +8,9 @@ const foo = "foo";
|
||||
let foo, bar = "bar";
|
||||
var foo, bar = "bar";
|
||||
|
||||
let foo = "foo", bar = "bar";
|
||||
var foo = "foo", bar = "bar";
|
||||
const foo = "foo", bar = "bar";
|
||||
let foo = "foo",
|
||||
bar = "bar";
|
||||
var foo = "foo",
|
||||
bar = "bar";
|
||||
const foo = "foo",
|
||||
bar = "bar";
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
var { x, y } = coords, foo = "bar";
|
||||
var { x, y } = coords,
|
||||
foo = "bar";
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
var foo = 1;
|
||||
var foo = 1, bar = 2;
|
||||
var foo = 1,
|
||||
bar = 2;
|
||||
var foo2 = function () {};
|
||||
var foo3 = undefined;
|
||||
var foo4 = 2;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var A = new WeakMap();
|
||||
var B = new WeakMap(), C = new WeakMap();
|
||||
var B = new WeakMap(),
|
||||
C = new WeakMap();
|
||||
var D = (function () {
|
||||
var F = new WeakMap(), G = new WeakMap();
|
||||
var F = new WeakMap(),
|
||||
G = new WeakMap();
|
||||
var E = new WeakMap();
|
||||
var D = function D() {};
|
||||
|
||||
@@ -11,7 +13,8 @@ var D = (function () {
|
||||
})();
|
||||
|
||||
var H = (function () {
|
||||
var J = new WeakMap(), K = new WeakMap();
|
||||
var J = new WeakMap(),
|
||||
K = new WeakMap();
|
||||
var I = new WeakMap();
|
||||
var _class = function () {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user