mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
## Summary - Fixed shell lexer to properly store error messages using TextRange instead of direct string slices - This prevents potential use-after-free issues when error messages are accessed after the lexer's string pool might have been reallocated - Added test coverage for shell syntax error reporting ## Changes - Changed `LexError.msg` from `[]const u8` to `Token.TextRange` to store indices into the string pool - Added `TextRange.slice()` helper method for converting ranges back to string slices - Updated error message concatenation logic to use the new range-based approach - Added test to verify syntax errors are reported correctly ## Test plan - [x] Added test case for invalid shell syntax error reporting - [x] Existing shell tests continue to pass - [x] Manual testing of various shell syntax errors closes BAPI-2232 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>