@@ -62,13 +62,13 @@ module.exports = {
6262
6363 /** @type {Map<ESNode, string> } */
6464 const restrictedCallNodes = new Map ( )
65- /** @type {Map<FunctionExpression | ArrowFunctionExpression | FunctionDeclaration | Program , SetupScopeData> } */
65+ /** @type {Map<FunctionExpression | ArrowFunctionExpression | FunctionDeclaration, SetupScopeData> } */
6666 const setupScopes = new Map ( )
6767
6868 /**x
6969 * @typedef {object } ScopeStack
7070 * @property {ScopeStack | null } upper
71- * @property {FunctionExpression | ArrowFunctionExpression | FunctionDeclaration | Program } scopeNode
71+ * @property {FunctionExpression | ArrowFunctionExpression | FunctionDeclaration } scopeNode
7272 */
7373 /** @type {ScopeStack | null } */
7474 let scopeStack = null
@@ -142,11 +142,6 @@ module.exports = {
142142 {
143143 /** @param {Program } node */
144144 Program ( node ) {
145- scopeStack = {
146- upper : scopeStack ,
147- scopeNode : node
148- }
149-
150145 const tracker = new ReferenceTracker ( context . getScope ( ) )
151146
152147 for ( const option of context . options ) {
@@ -181,6 +176,14 @@ module.exports = {
181176 }
182177 }
183178 }
179+ }
180+ } ,
181+ utils . defineVueVisitor ( context , {
182+ onSetupFunctionEnter ( node ) {
183+ setupScopes . set ( node , {
184+ afterAwait : false ,
185+ range : node . range
186+ } )
184187 } ,
185188 /** @param {FunctionExpression | ArrowFunctionExpression | FunctionDeclaration } node */
186189 ':function' ( node ) {
@@ -225,31 +228,6 @@ module.exports = {
225228 data : { message }
226229 } )
227230 }
228- }
229- } ,
230- ( ( ) => {
231- const scriptSetup = utils . getScriptSetupElement ( context )
232- if ( ! scriptSetup ) {
233- return { }
234- }
235- return {
236- /**
237- * @param {Program } node
238- */
239- Program ( node ) {
240- setupScopes . set ( node , {
241- afterAwait : false ,
242- range : scriptSetup . range
243- } )
244- }
245- }
246- } ) ( ) ,
247- utils . defineVueVisitor ( context , {
248- onSetupFunctionEnter ( node ) {
249- setupScopes . set ( node , {
250- afterAwait : false ,
251- range : node . range
252- } )
253231 } ,
254232 onSetupFunctionExit ( node ) {
255233 setupScopes . delete ( node )
0 commit comments