Fix issue semi-colon gets inserted unnecessarily (#5749)
* Fix issue semi-colon gets inserted unnecessarily * Simplify if condition a bit
This commit is contained in:
parent
2788a914f6
commit
c474fd48e1
@ -17,14 +17,11 @@ var A = function (_B) {
|
|||||||
_classCallCheck(this, A);
|
_classCallCheck(this, A);
|
||||||
|
|
||||||
if (track !== undefined) {
|
if (track !== undefined) {
|
||||||
;
|
|
||||||
|
|
||||||
var _this = _possibleConstructorReturn(this, (A.__proto__ || Object.getPrototypeOf(A)).call(this, track));
|
var _this = _possibleConstructorReturn(this, (A.__proto__ || Object.getPrototypeOf(A)).call(this, track));
|
||||||
} else {
|
} else {
|
||||||
;
|
|
||||||
|
|
||||||
var _this = _possibleConstructorReturn(this, (A.__proto__ || Object.getPrototypeOf(A)).call(this));
|
var _this = _possibleConstructorReturn(this, (A.__proto__ || Object.getPrototypeOf(A)).call(this));
|
||||||
}return _possibleConstructorReturn(_this);
|
}
|
||||||
|
return _possibleConstructorReturn(_this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return A;
|
return A;
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
if (true) [a, b] = [b, a];
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
if (true) {
|
||||||
|
var _ref = [b, a];
|
||||||
|
a = _ref[0];
|
||||||
|
b = _ref[1];
|
||||||
|
_ref;
|
||||||
|
}
|
||||||
@ -126,7 +126,10 @@ export function insertAfter(nodes) {
|
|||||||
if (Array.isArray(this.container)) {
|
if (Array.isArray(this.container)) {
|
||||||
return this._containerInsertAfter(nodes);
|
return this._containerInsertAfter(nodes);
|
||||||
} else if (this.isStatementOrBlock()) {
|
} else if (this.isStatementOrBlock()) {
|
||||||
if (this.node) nodes.unshift(this.node);
|
// Unshift current node if it's not an empty expression
|
||||||
|
if (this.node && (!this.isExpressionStatement() || this.node.expression != null)) {
|
||||||
|
nodes.unshift(this.node);
|
||||||
|
}
|
||||||
this._replaceWith(t.blockStatement(nodes));
|
this._replaceWith(t.blockStatement(nodes));
|
||||||
} else {
|
} else {
|
||||||
throw new Error("We don't know what to do with this node type. " +
|
throw new Error("We don't know what to do with this node type. " +
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user