(child: Node, parent: Node | null)
| 641 | const scope: Statement[][] = [scriptSetupAst.body] |
| 642 | walk(node, { |
| 643 | enter(child: Node, parent: Node | null) { |
| 644 | if (isFunctionType(child)) { |
| 645 | this.skip() |
| 646 | } |
| 647 | if (child.type === 'BlockStatement') { |
| 648 | scope.push(child.body) |
| 649 | } |
| 650 | if (child.type === 'AwaitExpression') { |
| 651 | hasAwait = true |
| 652 | // if the await expression is an expression statement and |
| 653 | // - is in the root scope |
| 654 | // - or is not the first statement in a nested block scope |
| 655 | // then it needs a semicolon before the generated code. |
| 656 | const currentScope = scope[scope.length - 1] |
| 657 | const needsSemi = currentScope.some((n, i) => { |
| 658 | return ( |
| 659 | (scope.length === 1 || i > 0) && |
| 660 | n.type === 'ExpressionStatement' && |
| 661 | n.start === child.start |
| 662 | ) |
| 663 | }) |
| 664 | processAwait( |
| 665 | ctx, |
| 666 | child, |
| 667 | needsSemi, |
| 668 | parent!.type === 'ExpressionStatement', |
| 669 | ) |
| 670 | } |
| 671 | }, |
| 672 | exit(node: Node) { |
| 673 | if (node.type === 'BlockStatement') scope.pop() |
| 674 | }, |
nothing calls this directly
no test coverage detected