|
|
@@ -168,405 +168,6 @@ return { n, x }
|
|
|
})"
|
|
|
`;
|
|
|
|
|
|
-exports[`SFC compile <script setup> > async/await detection > expression statement 1`] = `
|
|
|
-"import { withAsyncContext as _withAsyncContext } from 'vue'
|
|
|
-
|
|
|
-export default {
|
|
|
- async setup(__props) {
|
|
|
-
|
|
|
-let __temp, __restore
|
|
|
-;(
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => foo)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
-return { }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > multiple \`if for\` nested statements 1`] = `
|
|
|
-"import { withAsyncContext as _withAsyncContext } from 'vue'
|
|
|
-
|
|
|
-export default {
|
|
|
- async setup(__props) {
|
|
|
-
|
|
|
-let __temp, __restore
|
|
|
-if (ok) {
|
|
|
- for (let a of [1,2,3]) {
|
|
|
- (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => a)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
- }
|
|
|
- for (let a of [1,2,3]) {
|
|
|
- (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => a)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
- ;(
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => a)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
- }
|
|
|
- }
|
|
|
-return { }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > multiple \`if while\` nested statements 1`] = `
|
|
|
-"import { withAsyncContext as _withAsyncContext } from 'vue'
|
|
|
-
|
|
|
-export default {
|
|
|
- async setup(__props) {
|
|
|
-
|
|
|
-let __temp, __restore
|
|
|
-if (ok) {
|
|
|
- while (d) {
|
|
|
- (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 5)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
- }
|
|
|
- while (d) {
|
|
|
- (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 5)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
- ;(
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 6)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
- if (c) {
|
|
|
- let f = 10
|
|
|
- 10 + (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 7)),
|
|
|
- __temp = await __temp,
|
|
|
- __restore(),
|
|
|
- __temp
|
|
|
-)
|
|
|
- } else {
|
|
|
- (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 8)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
- ;(
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 9)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-return { }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > multiple \`if\` nested statements 1`] = `
|
|
|
-"import { withAsyncContext as _withAsyncContext } from 'vue'
|
|
|
-
|
|
|
-export default {
|
|
|
- async setup(__props) {
|
|
|
-
|
|
|
-let __temp, __restore
|
|
|
-if (ok) {
|
|
|
- let a = 'foo'
|
|
|
- ;(
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 0)),
|
|
|
- __temp = await __temp,
|
|
|
- __restore(),
|
|
|
- __temp
|
|
|
-) + (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 1)),
|
|
|
- __temp = await __temp,
|
|
|
- __restore(),
|
|
|
- __temp
|
|
|
-)
|
|
|
- ;(
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 2)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
- } else if (a) {
|
|
|
- (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 10)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
- if (b) {
|
|
|
- (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 0)),
|
|
|
- __temp = await __temp,
|
|
|
- __restore(),
|
|
|
- __temp
|
|
|
-) + (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 1)),
|
|
|
- __temp = await __temp,
|
|
|
- __restore(),
|
|
|
- __temp
|
|
|
-)
|
|
|
- } else {
|
|
|
- let a = 'foo'
|
|
|
- ;(
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 2)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
- }
|
|
|
- if (b) {
|
|
|
- (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 3)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
- ;(
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 4)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
- }
|
|
|
- } else {
|
|
|
- (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 5)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
- }
|
|
|
-return { }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > nested await 1`] = `
|
|
|
-"import { withAsyncContext as _withAsyncContext } from 'vue'
|
|
|
-
|
|
|
-export default {
|
|
|
- async setup(__props) {
|
|
|
-
|
|
|
-let __temp, __restore
|
|
|
-;(
|
|
|
- ([__temp,__restore] = _withAsyncContext(async () => ((
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => foo)),
|
|
|
- __temp = await __temp,
|
|
|
- __restore(),
|
|
|
- __temp
|
|
|
-)))),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
-return { }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > nested await 2`] = `
|
|
|
-"import { withAsyncContext as _withAsyncContext } from 'vue'
|
|
|
-
|
|
|
-export default {
|
|
|
- async setup(__props) {
|
|
|
-
|
|
|
-let __temp, __restore
|
|
|
-;(
|
|
|
- ([__temp,__restore] = _withAsyncContext(async () => (((
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => foo)),
|
|
|
- __temp = await __temp,
|
|
|
- __restore(),
|
|
|
- __temp
|
|
|
-))))),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
-return { }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > nested await 3`] = `
|
|
|
-"import { withAsyncContext as _withAsyncContext } from 'vue'
|
|
|
-
|
|
|
-export default {
|
|
|
- async setup(__props) {
|
|
|
-
|
|
|
-let __temp, __restore
|
|
|
-;(
|
|
|
- ([__temp,__restore] = _withAsyncContext(async () => ((
|
|
|
- ([__temp,__restore] = _withAsyncContext(async () => ((
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => foo)),
|
|
|
- __temp = await __temp,
|
|
|
- __restore(),
|
|
|
- __temp
|
|
|
-)))),
|
|
|
- __temp = await __temp,
|
|
|
- __restore(),
|
|
|
- __temp
|
|
|
-)))),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
-return { }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > nested leading await in expression statement 1`] = `
|
|
|
-"import { withAsyncContext as _withAsyncContext } from 'vue'
|
|
|
-
|
|
|
-export default {
|
|
|
- async setup(__props) {
|
|
|
-
|
|
|
-let __temp, __restore
|
|
|
-foo()
|
|
|
-;(
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 1)),
|
|
|
- __temp = await __temp,
|
|
|
- __restore(),
|
|
|
- __temp
|
|
|
-) + (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => 2)),
|
|
|
- __temp = await __temp,
|
|
|
- __restore(),
|
|
|
- __temp
|
|
|
-)
|
|
|
-return { }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > nested statements 1`] = `
|
|
|
-"import { withAsyncContext as _withAsyncContext } from 'vue'
|
|
|
-
|
|
|
-export default {
|
|
|
- async setup(__props) {
|
|
|
-
|
|
|
-let __temp, __restore
|
|
|
-if (ok) { (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => foo)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-) } else { (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => bar)),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-) }
|
|
|
-return { }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > ref 1`] = `
|
|
|
-"import { withAsyncContext as _withAsyncContext } from 'vue'
|
|
|
-
|
|
|
-export default {
|
|
|
- async setup(__props) {
|
|
|
-
|
|
|
-let __temp, __restore
|
|
|
-let a = $ref(1 + ((
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => foo)),
|
|
|
- __temp = await __temp,
|
|
|
- __restore(),
|
|
|
- __temp
|
|
|
-)))
|
|
|
-return { a }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > should ignore await inside functions 1`] = `
|
|
|
-"export default {
|
|
|
- setup(__props) {
|
|
|
-async function foo() { await bar }
|
|
|
-return { foo }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > should ignore await inside functions 2`] = `
|
|
|
-"export default {
|
|
|
- setup(__props) {
|
|
|
-const foo = async () => { await bar }
|
|
|
-return { foo }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > should ignore await inside functions 3`] = `
|
|
|
-"export default {
|
|
|
- setup(__props) {
|
|
|
-const obj = { async method() { await bar }}
|
|
|
-return { obj }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > should ignore await inside functions 4`] = `
|
|
|
-"export default {
|
|
|
- setup(__props) {
|
|
|
-const cls = class Foo { async method() { await bar }}
|
|
|
-return { cls }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > single line conditions 1`] = `
|
|
|
-"import { withAsyncContext as _withAsyncContext } from 'vue'
|
|
|
-
|
|
|
-export default {
|
|
|
- async setup(__props) {
|
|
|
-
|
|
|
-let __temp, __restore
|
|
|
-if (false) (
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => foo())),
|
|
|
- await __temp,
|
|
|
- __restore()
|
|
|
-)
|
|
|
-return { }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
-exports[`SFC compile <script setup> > async/await detection > variable 1`] = `
|
|
|
-"import { withAsyncContext as _withAsyncContext } from 'vue'
|
|
|
-
|
|
|
-export default {
|
|
|
- async setup(__props) {
|
|
|
-
|
|
|
-let __temp, __restore
|
|
|
-const a = 1 + ((
|
|
|
- ([__temp,__restore] = _withAsyncContext(() => foo)),
|
|
|
- __temp = await __temp,
|
|
|
- __restore(),
|
|
|
- __temp
|
|
|
-))
|
|
|
-return { a }
|
|
|
-}
|
|
|
-
|
|
|
-}"
|
|
|
-`;
|
|
|
-
|
|
|
exports[`SFC compile <script setup> > binding analysis for destructure 1`] = `
|
|
|
"export default {
|
|
|
setup(__props) {
|