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

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