@@ -39,7 +39,7 @@ function createPropVariables() {
39
39
if ( ! hasBeenWritten ) {
40
40
// copy on write
41
41
propVariables = new Map ( propVariables ) ;
42
- Object . assign ( stack [ stack . length - 1 ] , { propVariables, hasBeenWritten : true } ) ;
42
+ Object . assign ( stack [ stack . length - 1 ] , { propVariables, hasBeenWritten : true } ) ;
43
43
stack [ stack . length - 1 ] . hasBeenWritten = true ;
44
44
}
45
45
return propVariables . set ( name , allNames ) ;
@@ -271,6 +271,8 @@ module.exports = function usedPropTypesInstructions(context, components, utils)
271
271
const checkAsyncSafeLifeCycles = versionUtil . testReactVersion ( context , '16.3.0' ) ;
272
272
273
273
const propVariables = createPropVariables ( ) ;
274
+ const pushScope = propVariables . pushScope ;
275
+ const popScope = propVariables . popScope ;
274
276
275
277
/**
276
278
* Mark a prop type as used
@@ -422,7 +424,7 @@ module.exports = function usedPropTypesInstructions(context, components, utils)
422
424
* FunctionDeclaration, or FunctionExpression
423
425
*/
424
426
function handleFunctionLikeExpressions ( node ) {
425
- propVariables . pushScope ( ) ;
427
+ pushScope ( ) ;
426
428
handleSetStateUpdater ( node ) ;
427
429
markDestructuredFunctionArgumentsAsUsed ( node ) ;
428
430
}
@@ -497,11 +499,11 @@ module.exports = function usedPropTypesInstructions(context, components, utils)
497
499
498
500
FunctionExpression : handleFunctionLikeExpressions ,
499
501
500
- 'FunctionDeclaration:exit' : propVariables . popScope ,
502
+ 'FunctionDeclaration:exit' : popScope ,
501
503
502
- 'ArrowFunctionExpression:exit' : propVariables . popScope ,
504
+ 'ArrowFunctionExpression:exit' : popScope ,
503
505
504
- 'FunctionExpression:exit' : propVariables . popScope ,
506
+ 'FunctionExpression:exit' : popScope ,
505
507
506
508
JSXSpreadAttribute ( node ) {
507
509
const component = components . get ( utils . getParentComponent ( ) ) ;
0 commit comments