Remove whitespace generation (#5833)

* Remove whitespace generation and rely on default printing

Changes to printing:
* Add newline after last empty SwitchCase
* Add newlines around block comments if they are non-flow comments or contain newlines

* Fix a few more fixtures
This commit is contained in:
Daniel Tschinder
2017-06-27 19:57:02 -07:00
committed by Brian Ng
parent bc29145465
commit b3372a572d
379 changed files with 1974 additions and 1109 deletions

View File

@@ -15,4 +15,5 @@ let TestClass = {
};
})());
}
};
};

View File

@@ -1,7 +1,9 @@
let foo = (() => {
var _ref2 = babelHelpers.asyncToGenerator(function* (_ref) {
let { a, b = mandatory("b") } = _ref;
let {
a,
b = mandatory("b")
} = _ref;
return Promise.resolve(b);
});
@@ -12,4 +14,4 @@ let foo = (() => {
function mandatory(paramName) {
throw new Error(`Missing parameter: ${paramName}`);
}
}

View File

@@ -4,4 +4,5 @@ class Foo {
var wat = yield bar();
})();
}
}
}

View File

@@ -25,8 +25,8 @@ let s = (() => {
return _ref3.apply(this, arguments);
};
})();
yield r();
yield r();
console.log(_this, args, _arguments);
return _this.g(r);
});
@@ -43,4 +43,4 @@ let s = (() => {
return function s(_x) {
return _ref.apply(this, arguments);
};
})();
})();

View File

@@ -31,7 +31,9 @@ let four = (() => {
})();
let five = (() => {
var _ref5 = babelHelpers.asyncToGenerator(function* (a, { b }) {});
var _ref5 = babelHelpers.asyncToGenerator(function* (a, {
b
}) {});
return function five(_x6, _x7) {
return _ref5.apply(this, arguments);
@@ -39,7 +41,9 @@ let five = (() => {
})();
let six = (() => {
var _ref6 = babelHelpers.asyncToGenerator(function* (a, { b } = {}) {});
var _ref6 = babelHelpers.asyncToGenerator(function* (a, {
b
} = {}) {});
return function six(_x8) {
return _ref6.apply(this, arguments);

View File

@@ -4,33 +4,43 @@ class Class {
return babelHelpers.asyncToGenerator(function* () {
_this;
() => _this;
() => {
_this;
() => _this;
function x() {
var _this2 = this;
this;
() => {
this;
};
babelHelpers.asyncToGenerator(function* () {
_this2;
});
}
};
function x() {
var _this3 = this;
this;
() => {
this;
};
babelHelpers.asyncToGenerator(function* () {
_this3;
});
}
})();
}
}
}

View File

@@ -8,4 +8,5 @@ class Foo extends class {} {
var arrow = () => _superprop_callMethod();
})();
}
}

View File

@@ -1,8 +1,10 @@
let obj = {
a: 123,
foo(bar) {
return babelHelpers.asyncToGenerator(function* () {
return yield baz(bar);
})();
}
};
};

View File

@@ -11,7 +11,6 @@ let foo = (() => {
})();
let Promise;
yield bar();
});
@@ -22,4 +21,4 @@ let foo = (() => {
function _asyncToGenerator(fn) { return function () { return new Promise((resolve, reject) => { var gen = fn.apply(this, arguments); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _next(value) { step("next", value); } function _throw(err) { step("throw", err); } _next(); }); }; }
let _Promise;
let _Promise;

View File

@@ -1,7 +1,6 @@
babelHelpers.asyncToGenerator(function* () {
return yield promise;
});
babelHelpers.asyncToGenerator(function* () {
yield promise;
});
});

View File

@@ -5,7 +5,6 @@ let foo = (() => {
let a = _ref2.a,
_ref2$b = _ref2.b,
b = _ref2$b === undefined ? mandatory("b") : _ref2$b;
return Promise.resolve(b);
});
@@ -18,4 +17,4 @@ function _asyncToGenerator(fn) { return function () { return new Promise((resolv
function mandatory(paramName) {
throw new Error(`Missing parameter: ${paramName}`);
}
}

View File

@@ -4,7 +4,6 @@ class Test {
return babelHelpers.asyncToGenerator(function* () {
console.log(_this);
setTimeout(babelHelpers.asyncToGenerator(function* () {
console.log(_this);
}));
@@ -16,7 +15,6 @@ class Test {
return babelHelpers.asyncToGenerator(function* () {
console.log(_this2);
setTimeout((() => {
var _ref2 = babelHelpers.asyncToGenerator(function* (arg) {
console.log(_this2);
@@ -34,7 +32,6 @@ class Test {
return babelHelpers.asyncToGenerator(function* () {
console.log(_this3);
setTimeout(babelHelpers.asyncToGenerator(function* () {
console.log(_this3);
}));
@@ -46,7 +43,6 @@ class Test {
return babelHelpers.asyncToGenerator(function* () {
console.log(_this4);
setTimeout((() => {
var _ref4 = babelHelpers.asyncToGenerator(function* (arg) {
console.log(_this4);
@@ -58,4 +54,5 @@ class Test {
})());
})();
}
}
}

View File

@@ -11,7 +11,9 @@ function f() {
babelHelpers.asyncToGenerator(function* () {
var _this2 = this;
console.log('async wrapper:', this === 'foo');(function () {
console.log('async wrapper:', this === 'foo');
(function () {
console.log('nested arrow:', _this2 === 'foo');
})();
}).call('foo');
}).call('foo');