static boolean isBlockScopedDeclaration ( Node n ) { if ( n . isName ( ) ) { switch ( n . getParent ( ) . getToken ( ) ) { case LET : case CONST : case CATCH : return true ; case CLASS : return n . getParent ( ) . getFirstChild ( ) == n ; case FUNCTION : return isBlockScopedFunctionDeclaration ( n . getParent ( ) ) ; default : break ; } } return false ; }
Is this node the name of a block - scoped declaration? Checks for let const class or block - scoped function declarations .