@@ -62,13 +62,13 @@ module.exports = {
62
62
63
63
/** @type {Map<ESNode, string> } */
64
64
const restrictedCallNodes = new Map ( )
65
- /** @type {Map<FunctionExpression | ArrowFunctionExpression | FunctionDeclaration | Program , SetupScopeData> } */
65
+ /** @type {Map<FunctionExpression | ArrowFunctionExpression | FunctionDeclaration, SetupScopeData> } */
66
66
const setupScopes = new Map ( )
67
67
68
68
/**x
69
69
* @typedef {object } ScopeStack
70
70
* @property {ScopeStack | null } upper
71
- * @property {FunctionExpression | ArrowFunctionExpression | FunctionDeclaration | Program } scopeNode
71
+ * @property {FunctionExpression | ArrowFunctionExpression | FunctionDeclaration } scopeNode
72
72
*/
73
73
/** @type {ScopeStack | null } */
74
74
let scopeStack = null
@@ -142,11 +142,6 @@ module.exports = {
142
142
{
143
143
/** @param {Program } node */
144
144
Program ( node ) {
145
- scopeStack = {
146
- upper : scopeStack ,
147
- scopeNode : node
148
- }
149
-
150
145
const tracker = new ReferenceTracker ( context . getScope ( ) )
151
146
152
147
for ( const option of context . options ) {
@@ -181,6 +176,14 @@ module.exports = {
181
176
}
182
177
}
183
178
}
179
+ }
180
+ } ,
181
+ utils . defineVueVisitor ( context , {
182
+ onSetupFunctionEnter ( node ) {
183
+ setupScopes . set ( node , {
184
+ afterAwait : false ,
185
+ range : node . range
186
+ } )
184
187
} ,
185
188
/** @param {FunctionExpression | ArrowFunctionExpression | FunctionDeclaration } node */
186
189
':function' ( node ) {
@@ -225,31 +228,6 @@ module.exports = {
225
228
data : { message }
226
229
} )
227
230
}
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
- } )
253
231
} ,
254
232
onSetupFunctionExit ( node ) {
255
233
setupScopes . delete ( node )
0 commit comments