add auxiliary comment to let scoping closure flow control - fixes #819

This commit is contained in:
Sebastian McKenzie
2015-02-18 11:35:57 +11:00
parent 64e657e53d
commit f228edbb84
2 changed files with 11 additions and 4 deletions

View File

@@ -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**

View File

@@ -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));
}
}
};