MCPcopy
hub / github.com/vuejs/core / enter

Function enter

packages/compiler-sfc/src/compileScript.ts:643–671  ·  view source on GitHub ↗
(child: Node, parent: Node | null)

Source from the content-addressed store, hash-verified

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 },

Callers

nothing calls this directly

Calls 4

processAwaitFunction · 0.90
isFunctionTypeFunction · 0.85
someMethod · 0.80
pushMethod · 0.65

Tested by

no test coverage detected