diff --git a/CHANGELOG.md b/CHANGELOG.md index f08303111f..5c70812b8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ _Note: Gaps between patch versions are faulty/broken releases._ See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog. +## 4.2.1 + + * **Polish** + * Add auxiliary comment to let scoping closure flow control. + ## 4.2.0 * **Polish** diff --git a/lib/babel/transformation/transformers/es6/block-scoping.js b/lib/babel/transformation/transformers/es6/block-scoping.js index 9b06f1adac..bf486fb2b1 100644 --- a/lib/babel/transformation/transformers/es6/block-scoping.js +++ b/lib/babel/transformation/transformers/es6/block-scoping.js @@ -546,14 +546,16 @@ BlockScoping.prototype.buildHas = function (ret, call) { if (cases.length === 1) { var single = cases[0]; - body.push(t.ifStatement( + body.push(this.file.attachAuxiliaryComment(t.ifStatement( t.binaryExpression("===", ret, single.test), single.consequent[0] - )); + ))); } else { - body.push(t.switchStatement(ret, cases)); + body.push(this.file.attachAuxiliaryComment(t.switchStatement(ret, cases))); } } else { - if (has.hasReturn) body.push(retCheck); + if (has.hasReturn) { + body.push(this.file.attachAuxiliaryComment(retCheck)); + } } };