@@ -96,37 +96,26 @@ export default /*#__PURE__*/ Object.assign(__default__, {
9696} )"
9797`;
9898
99- exports[`SFC compile <script setup > async/await detection await in expression statement 1`] = `
99+ exports[`SFC compile <script setup > async/await detection expression statement 1`] = `
100100"import { withAsyncContext as _withAsyncContext } from 'vue'
101101
102102export default {
103103 async setup (__props , { expose }) {
104104 expose()
105105
106106let __temp, __restore
107- foo()
108107;(
109- ([__temp ,__restore ] = _withAsyncContext (() => {
110- return 1
111- })),
112- __temp = await __temp ,
113- __restore(),
114- __temp
115- ) + (
116- ([__temp ,__restore ] = _withAsyncContext (() => {
117- return 2
118- })),
119- __temp = await __temp ,
120- __restore(),
121- __temp
108+ ([__temp ,__restore ] = _withAsyncContext (() => foo )),
109+ await __temp ,
110+ __restore()
122111)
123112return { }
124113}
125114
126115} "
127116`;
128117
129- exports[`SFC compile <script setup > async/await detection expression statement 1`] = `
118+ exports[`SFC compile <script setup > async/await detection nested await 1`] = `
130119"import { withAsyncContext as _withAsyncContext } from 'vue'
131120
132121export default {
@@ -135,20 +124,22 @@ export default {
135124
136125let __temp, __restore
137126;(
138- ([__temp ,__restore ] = _withAsyncContext (() => {
139- return foo
140- })),
127+ ([__temp ,__restore ] = _withAsyncContext (async () => ((
128+ ([__temp ,__restore ] = _withAsyncContext (() => foo )),
141129 __temp = await __temp ,
142130 __restore (),
143131 __temp
132+ )))),
133+ await __temp ,
134+ __restore()
144135)
145136return { }
146137}
147138
148139} "
149140`;
150141
151- exports[`SFC compile <script setup > async/await detection nested await 1 `] = `
142+ exports[`SFC compile <script setup > async/await detection nested await 2 `] = `
152143"import { withAsyncContext as _withAsyncContext } from 'vue'
153144
154145export default {
@@ -157,27 +148,22 @@ export default {
157148
158149let __temp, __restore
159150;(
160- ([__temp ,__restore ] = _withAsyncContext (async () => {
161- return ((
162- ([__temp ,__restore ] = _withAsyncContext (() => {
163- return foo
164- })),
165- __temp = await __temp ,
166- __restore (),
167- __temp
168- ))
169- })),
151+ ([__temp ,__restore ] = _withAsyncContext (async () => (((
152+ ([__temp ,__restore ] = _withAsyncContext (() => foo )),
170153 __temp = await __temp ,
171154 __restore (),
172155 __temp
156+ ))))),
157+ await __temp ,
158+ __restore()
173159)
174160return { }
175161}
176162
177163} "
178164`;
179165
180- exports[`SFC compile <script setup > async/await detection nested await 2 `] = `
166+ exports[`SFC compile <script setup > async/await detection nested await 3 `] = `
181167"import { withAsyncContext as _withAsyncContext } from 'vue'
182168
183169export default {
@@ -186,52 +172,42 @@ export default {
186172
187173let __temp, __restore
188174;(
189- ([__temp ,__restore ] = _withAsyncContext (async () => {
190- return (((
191- ([__temp ,__restore ] = _withAsyncContext (() => {
192- return foo
193- })),
175+ ([__temp ,__restore ] = _withAsyncContext (async () => ((
176+ ([__temp ,__restore ] = _withAsyncContext (async () => ((
177+ ([__temp ,__restore ] = _withAsyncContext (() => foo )),
194178 __temp = await __temp ,
195179 __restore (),
196180 __temp
197- )))
198- })),
181+ )))),
199182 __temp = await __temp ,
200183 __restore (),
201184 __temp
185+ )))),
186+ await __temp ,
187+ __restore()
202188)
203189return { }
204190}
205191
206192} "
207193`;
208194
209- exports[`SFC compile <script setup > async/await detection nested await 3 `] = `
195+ exports[`SFC compile <script setup > async/await detection nested leading await in expression statement 1 `] = `
210196"import { withAsyncContext as _withAsyncContext } from 'vue'
211197
212198export default {
213199 async setup (__props , { expose }) {
214200 expose()
215201
216202let __temp, __restore
203+ foo()
217204;(
218- ([__temp ,__restore ] = _withAsyncContext (async () => {
219- return ((
220- ([__temp ,__restore ] = _withAsyncContext (async () => {
221- return ((
222- ([__temp ,__restore ] = _withAsyncContext (() => {
223- return foo
224- })),
205+ ([__temp ,__restore ] = _withAsyncContext (() => 1 )),
225206 __temp = await __temp ,
226207 __restore(),
227208 __temp
228- ))
229- })),
230- __temp = await __temp ,
231- __restore (),
232- __temp
233- ))
234- })),
209+ ) + (
210+ ([__temp ,__restore ] = _withAsyncContext (() => 2 )),
235211 __temp = await __temp ,
236212 __restore(),
237213 __temp
@@ -251,19 +227,13 @@ export default {
251227
252228let __temp, __restore
253229if (ok ) { (
254- ([__temp ,__restore ] = _withAsyncContext (() => {
255- return foo
256- })),
257- __temp = await __temp ,
258- __restore (),
259- __temp
230+ ([__temp ,__restore ] = _withAsyncContext (() => foo )),
231+ await __temp ,
232+ __restore ()
260233) } else { (
261- ([__temp ,__restore ] = _withAsyncContext (() => {
262- return bar
263- })),
264- __temp = await __temp ,
265- __restore(),
266- __temp
234+ ([__temp ,__restore ] = _withAsyncContext (() => bar )),
235+ await __temp ,
236+ __restore()
267237) }
268238return { }
269239}
@@ -280,9 +250,7 @@ export default {
280250
281251let __temp, __restore
282252let a = _ref(1 + ((
283- ([__temp ,__restore ] = _withAsyncContext (() => {
284- return foo
285- })),
253+ ([__temp ,__restore ] = _withAsyncContext (() => foo )),
286254 __temp = await __temp ,
287255 __restore(),
288256 __temp
@@ -346,12 +314,9 @@ export default {
346314
347315let __temp, __restore
348316if (false ) (
349- ([__temp ,__restore ] = _withAsyncContext (() => {
350- return foo ()
351- })),
352- __temp = await __temp ,
353- __restore(),
354- __temp
317+ ([__temp ,__restore ] = _withAsyncContext (() => foo ())),
318+ await __temp ,
319+ __restore()
355320)
356321return { }
357322}
@@ -368,9 +333,7 @@ export default {
368333
369334let __temp, __restore
370335const a = 1 + ((
371- ([__temp ,__restore ] = _withAsyncContext (() => {
372- return foo
373- })),
336+ ([__temp ,__restore ] = _withAsyncContext (() => foo )),
374337 __temp = await __temp ,
375338 __restore(),
376339 __temp
0 commit comments