Fix catch error on do expression and add tests (#6372)

Fixes #6331
This commit is contained in:
William 2017-10-04 18:19:54 +02:00 committed by Nicolò Ribaudo
parent 02d0b74d37
commit 36d8a13f4d
4 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,7 @@
const x = do {
try {
a();
} catch (e) {
b();
}
}

View File

@ -0,0 +1,7 @@
var x = function () {
try {
return a();
} catch (e) {
return b();
}
}();

View File

@ -0,0 +1,3 @@
{
"plugins": ["transform-es2015-block-scoping", "transform-do-expressions"]
}

View File

@ -33,6 +33,8 @@ export function getCompletionRecords(): Array {
paths = addCompletionRecords(this.get("block"), paths);
paths = addCompletionRecords(this.get("handler"), paths);
paths = addCompletionRecords(this.get("finalizer"), paths);
} else if (this.isCatchClause()) {
paths = addCompletionRecords(this.get("body"), paths);
} else {
paths.push(this);
}