## Dead Code (Medium)

### Trigger Signals

- Code after `return`/`throw`/`break`/`continue` (unreachable)
- Always true/false conditions (`if (true)`, `if (1)`, `while (false)`)
- Exported function/class not referenced by any file
- `switch` branch without `break`/`return` and no `// fallthrough` comment
- `else` branch redundant when `if` already returns/throws

### Judgment Process

1. **Check unreachable code**: `Read` extracts all `return`/`throw`/`break`/`continue` statements, checking whether code follows (excluding comments and closing braces)
2. **Check always true/false conditions**: `Read` identifies the following patterns:
   - `if (true)` / `if (false)` / `if (1)` / `if (0)`
   - `while (true)` has legitimate uses (event loops), but `while (false)` is meaningless
   - Short-circuit expressions: `true && x` is equivalent to `x`, `false || x` is equivalent to `x`
3. **Check unused exports**: `find_references` tracks references of exported functions/classes, confirming whether they are imported and used by other files
4. **Check switch fallthrough**: `Read` confirms whether `case` branches end with `break`/`return`/`throw`, or have a `// fallthrough`/`// falls through` comment indicating intentional fallthrough

### Evidence Construction

After confirming a defect, the output must include:
- Unreachable code location (code after `return`/`throw`, with file:line number)
- Dead code type (unreachable/always-true condition/unused export/switch fallthrough)
- Recommendation (delete, add break, add explanatory comment)

### Exclusions

- `while (true)` + `break`/`return` event loop pattern
- Intentionally designed fallthrough (with `// fallthrough` comment)
- Library public API exports (designed for external use, even if not referenced in the current project)
- Exports in third-party dependencies that need to be installed (third-party dependencies are not visible, cannot confirm reference relationships)
- Conditional compilation code (`#ifdef`, `__DEV__`)
- TypeScript `never` type branches (default branch after exhaustive checking)
