Set correct async/generator in IIFE for params (#11346)

* Set correct async/generator in IIFE for params

* Reject in async params

* Skip async test on node 6 (it doesn't support async fns)
This commit is contained in:
Nicolò Ribaudo
2020-03-29 22:01:15 +02:00
committed by GitHub
parent 71e7a7b1e0
commit c8a8be7221
6 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
const err = new Error();
async function f(a = (() => { throw err })()) {
throw 1;
var a = await a;
return a;
}
return (async () => {
let p;
expect(() => { p = f() }).not.toThrow();
await expect(p).rejects.toThrow(err);
})();

View File

@@ -0,0 +1,9 @@
{
"plugins": [
"transform-parameters"
],
"parserOpts": {
"allowReturnOutsideFunction": true
},
"minNodeVersion": "8.0.0"
}