[turbopack] Refactor the analyzer to fix a few issues and prepare to split it up (#86265)
# Refactor Analyzer State Management in Turbopack
This PR refactors the state management in the Turbopack ECMAScript analyzer to improve code organization and maintainability. The changes include:
- Introduced a `LexicalContext` enum to track the current execution context (function, module, control flow) and remove most dependencies on AstPath
- Moved early return stack and variable declaration kind into the `AnalyzerState` struct
- Added helper methods for entering and exiting different block types
- Improved handling of nested blocks and control flow
- Fixed unreachable code detection in anonymous blocks which allows us to drop some redundant unreachable effects from loops
- Handle more cases for nested `var` declarations
These refactorings are all either fixing minor issues or regularizing state management. This is preparation for splitting this AST traversal into two pieces.