@@ -194,6 +194,173 @@ return { }
194
194
}"
195
195
`;
196
196
197
+ exports[`SFC compile <script setup> async/await detection multiple \`if for\` nested statements 1`] = `
198
+ "import { withAsyncContext as _withAsyncContext } from 'vue'
199
+
200
+ export default {
201
+ async setup(__props, { expose }) {
202
+ expose();
203
+
204
+ let __temp, __restore
205
+ if (ok) {
206
+ for (let a of [1,2,3]) {
207
+ (
208
+ ([__temp,__restore] = _withAsyncContext(() => a)),
209
+ await __temp,
210
+ __restore()
211
+ )
212
+ }
213
+ for (let a of [1,2,3]) {
214
+ (
215
+ ([__temp,__restore] = _withAsyncContext(() => a)),
216
+ await __temp,
217
+ __restore()
218
+ )
219
+ ;(
220
+ ([__temp,__restore] = _withAsyncContext(() => a)),
221
+ await __temp,
222
+ __restore()
223
+ )
224
+ }
225
+ }
226
+ return { }
227
+ }
228
+
229
+ }"
230
+ `;
231
+
232
+ exports[`SFC compile <script setup> async/await detection multiple \`if while\` nested statements 1`] = `
233
+ "import { withAsyncContext as _withAsyncContext } from 'vue'
234
+
235
+ export default {
236
+ async setup(__props, { expose }) {
237
+ expose();
238
+
239
+ let __temp, __restore
240
+ if (ok) {
241
+ while (d) {
242
+ (
243
+ ([__temp,__restore] = _withAsyncContext(() => 5)),
244
+ await __temp,
245
+ __restore()
246
+ )
247
+ }
248
+ while (d) {
249
+ (
250
+ ([__temp,__restore] = _withAsyncContext(() => 5)),
251
+ await __temp,
252
+ __restore()
253
+ )
254
+ ;(
255
+ ([__temp,__restore] = _withAsyncContext(() => 6)),
256
+ await __temp,
257
+ __restore()
258
+ )
259
+ if (c) {
260
+ let f = 10
261
+ 10 + (
262
+ ([__temp,__restore] = _withAsyncContext(() => 7)),
263
+ __temp = await __temp,
264
+ __restore(),
265
+ __temp
266
+ )
267
+ } else {
268
+ (
269
+ ([__temp,__restore] = _withAsyncContext(() => 8)),
270
+ await __temp,
271
+ __restore()
272
+ )
273
+ ;(
274
+ ([__temp,__restore] = _withAsyncContext(() => 9)),
275
+ await __temp,
276
+ __restore()
277
+ )
278
+ }
279
+ }
280
+ }
281
+ return { }
282
+ }
283
+
284
+ }"
285
+ `;
286
+
287
+ exports[`SFC compile <script setup> async/await detection multiple \`if\` nested statements 1`] = `
288
+ "import { withAsyncContext as _withAsyncContext } from 'vue'
289
+
290
+ export default {
291
+ async setup(__props, { expose }) {
292
+ expose();
293
+
294
+ let __temp, __restore
295
+ if (ok) {
296
+ let a = 'foo'
297
+ ;(
298
+ ([__temp,__restore] = _withAsyncContext(() => 0)),
299
+ __temp = await __temp,
300
+ __restore(),
301
+ __temp
302
+ ) + (
303
+ ([__temp,__restore] = _withAsyncContext(() => 1)),
304
+ __temp = await __temp,
305
+ __restore(),
306
+ __temp
307
+ )
308
+ ;(
309
+ ([__temp,__restore] = _withAsyncContext(() => 2)),
310
+ await __temp,
311
+ __restore()
312
+ )
313
+ } else if (a) {
314
+ (
315
+ ([__temp,__restore] = _withAsyncContext(() => 10)),
316
+ await __temp,
317
+ __restore()
318
+ )
319
+ if (b) {
320
+ (
321
+ ([__temp,__restore] = _withAsyncContext(() => 0)),
322
+ __temp = await __temp,
323
+ __restore(),
324
+ __temp
325
+ ) + (
326
+ ([__temp,__restore] = _withAsyncContext(() => 1)),
327
+ __temp = await __temp,
328
+ __restore(),
329
+ __temp
330
+ )
331
+ } else {
332
+ let a = 'foo'
333
+ ;(
334
+ ([__temp,__restore] = _withAsyncContext(() => 2)),
335
+ await __temp,
336
+ __restore()
337
+ )
338
+ }
339
+ if (b) {
340
+ (
341
+ ([__temp,__restore] = _withAsyncContext(() => 3)),
342
+ await __temp,
343
+ __restore()
344
+ )
345
+ ;(
346
+ ([__temp,__restore] = _withAsyncContext(() => 4)),
347
+ await __temp,
348
+ __restore()
349
+ )
350
+ }
351
+ } else {
352
+ (
353
+ ([__temp,__restore] = _withAsyncContext(() => 5)),
354
+ await __temp,
355
+ __restore()
356
+ )
357
+ }
358
+ return { }
359
+ }
360
+
361
+ }"
362
+ `;
363
+
197
364
exports[`SFC compile <script setup> async/await detection nested await 1`] = `
198
365
"import { withAsyncContext as _withAsyncContext } from 'vue'
199
366
0 commit comments