[turbopack] Consolodate logic for visiting functions to simplify state management (#82763)
Introduce a new helper function `enter_fn` in the analyzer to ensure state like `cur_fn_id` is consistently updated. Follow the existing pattern of moving the state into a private module to control access.
Leverage the early return stack information to detect when functions implicitly return `undefined`
This fixes an small set of set of issues
* cur_fn_id was not consistently updated
* some functions were identified as returning undefined when they didn't
Mostly this sets us up for a future where we can track other metadata based on the accurate `cur_fn_id` field