Skip to content

Commit

Permalink
chore: improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 authored and yyx990803 committed Sep 16, 2021
1 parent 15de5a2 commit f4da5d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/compiler-sfc/__tests__/compileScript.spec.ts
Expand Up @@ -1101,22 +1101,22 @@ const emit = defineEmits(['a', 'b'])
assertAwaitDetection(
`await (await foo)`,
`;(([__temp,__restore]=_withAsyncContext(` +
`()=>(((([__temp,__restore]=_withAsyncContext(` +
`async ()=>(((([__temp,__restore]=_withAsyncContext(` +
`()=>(foo))),__temp=await __temp,__restore(),__temp))))` +
`),__temp=await __temp,__restore())`
)
assertAwaitDetection(
`await ((await foo))`,
`;(([__temp,__restore]=_withAsyncContext(` +
`()=>((((([__temp,__restore]=_withAsyncContext(` +
`async ()=>((((([__temp,__restore]=_withAsyncContext(` +
`()=>(foo))),__temp=await __temp,__restore(),__temp)))))` +
`),__temp=await __temp,__restore())`
)
assertAwaitDetection(
`await (await (await foo))`,
`;(([__temp,__restore]=_withAsyncContext(` +
`()=>(((([__temp,__restore]=_withAsyncContext(` +
`()=>(((([__temp,__restore]=_withAsyncContext(` +
`async ()=>(((([__temp,__restore]=_withAsyncContext(` +
`async ()=>(((([__temp,__restore]=_withAsyncContext(` +
`()=>(foo))),__temp=await __temp,__restore(),__temp))))` +
`),__temp=await __temp,__restore(),__temp))))` +
`),__temp=await __temp,__restore())`
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-sfc/src/compileScript.ts
Expand Up @@ -520,7 +520,7 @@ export function compileScript(
end + startOffset,
`${isStatement ? `;` : ``}(([__temp,__restore]=${helper(
`withAsyncContext`
)}(()=>(`
)}(${node.argument.type === 'AwaitExpression' ? `async ` : ``}()=>(`
)
s.appendLeft(
node.end! + startOffset,
Expand Down

0 comments on commit f4da5d7

Please sign in to comment.