mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
fix: add missing $ and _ characters to identifier tables
The previous fix for middle dot characters accidentally broke $ and _
character parsing in JavaScript identifiers. These characters are
special cases in ECMAScript that must be explicitly added to the
ID_Start and ID_Continue sets, as they are not included in the
standard Unicode categories.
This restores support for:
- $ in destructuring: import { $ } from "bun"
- _ in variable names: const _private = 123
- All other $ and _ usage in identifiers
While maintaining the fix for Japanese middle dot characters.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -83,12 +83,12 @@ async function main() {
|
||||
{
|
||||
name: "isIDStartESNext",
|
||||
table: "idStartESNext",
|
||||
check: (cp: number) => idStartESNextSet.has(cp),
|
||||
check: (cp: number) => idStartESNextSet.has(cp) || cp === 0x24 || cp === 0x5F, // Add $ and _
|
||||
},
|
||||
{
|
||||
name: "isIDContinueESNext",
|
||||
table: "idContinueESNext",
|
||||
check: (cp: number) => idContinueESNextSet.has(cp) && !ID_Continue_mistake.has(cp),
|
||||
check: (cp: number) => (idContinueESNextSet.has(cp) && !ID_Continue_mistake.has(cp)) || cp === 0x24 || cp === 0x5F, // Add $ and _
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user