@@ -54,11 +54,12 @@ const testCases = [
54
54
'(async () => { return (console.log(`${(await { a: 1 }).a}`)) })()' ] ,
55
55
/* eslint-enable no-template-curly-in-string */
56
56
[ 'await 0; function foo() {}' ,
57
- 'var foo; (async () => { await 0; foo= function foo() {} })()' ] ,
57
+ 'var foo; (async () => { await 0; this. foo = foo; function foo() {} })()' ] ,
58
58
[ 'await 0; class Foo {}' ,
59
59
'let Foo; (async () => { await 0; Foo=class Foo {} })()' ] ,
60
60
[ 'if (await true) { function foo() {} }' ,
61
- 'var foo; (async () => { if (await true) { foo=function foo() {} } })()' ] ,
61
+ 'var foo; (async () => { ' +
62
+ 'if (await true) { this.foo = foo; function foo() {} } })()' ] ,
62
63
[ 'if (await true) { class Foo{} }' ,
63
64
'(async () => { if (await true) { class Foo{} } })()' ] ,
64
65
[ 'if (await true) { var a = 1; }' ,
@@ -116,6 +117,9 @@ const testCases = [
116
117
'(async () => { for (let i in {x:1}) { await 1 } })()' ] ,
117
118
[ 'for (const i in {x:1}) { await 1 }' ,
118
119
'(async () => { for (const i in {x:1}) { await 1 } })()' ] ,
120
+ [ 'var x = await foo(); async function foo() { return Promise.resolve(1);}' ,
121
+ 'var x; var foo; (async () => { void (x = await foo()); this.foo = foo; ' +
122
+ 'async function foo() { return Promise.resolve(1);} })()' ] ,
119
123
] ;
120
124
121
125
for ( const [ input , expected ] of testCases ) {
0 commit comments