Generate a contextual name for the extracted function/method. The naming follows these heuristics (first match wins): 1. **Guard strategies** (`VoidGuards`, `UniformGuards`, `NullGuardWithValue`): `{enclosing}Guard` — the user extracted validation / precondition logic. 2. **`SentinelNull`**: `try{Enclosing}` — a "try" pattern where `null` signals failure. 3. **`TrailingReturn` with `new ClassNam
(
content: &str,
enclosing_ctx: &EnclosingContext,
naming: &NamingContext,
)
| 396 | /// existing names in the appropriate scope (class members for methods, |
| 397 | /// file-level `function` declarations for standalone functions). |
| 398 | fn generate_function_name( |
| 399 | content: &str, |
| 400 | enclosing_ctx: &EnclosingContext, |
| 401 | naming: &NamingContext, |
| 402 | ) -> String { |
| 403 | let base = derive_base_name(naming); |
| 404 | |
| 405 | // Deduplicate against the right scope. |
| 406 | deduplicate_name(&base, content, enclosing_ctx) |
| 407 | } |
| 408 | |
| 409 | /// Pick a base name from the naming context (before deduplication). |
| 410 | fn derive_base_name(ctx: &NamingContext) -> String { |