Files
bun.sh/test/js
Claude Bot 8cc412a91c Fix crash when parsing invalid declare syntax
When parsing TypeScript code with invalid `declare` syntax like
`declare{}`, `declare{}_=>_`, or `declare {};()=>{};`, the parser
would create invalid AST structures that caused "Scope mismatch while
visiting" panics during the visit pass.

The issue was that `declare` must be followed by a valid declaration
keyword (class, function, var, const, let, enum, namespace, module,
interface, type, abstract, async, or global), but the parser wasn't
validating this. When followed by invalid tokens like `{`, the parser
would create `.block` scopes that didn't match the expected scope
types for subsequent constructs like arrow functions.

This fix adds validation to ensure `declare` is only followed by valid
declaration keywords, reporting a proper syntax error for invalid cases
instead of crashing with a scope mismatch panic.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 01:57:52 +00:00
..
2024-12-12 02:07:29 -08:00
2025-10-27 18:58:06 -07:00