Repository navigation
fix(parser): respect unicode escape in isUnparsedContextual - #18443
Merged
JLHwung merged 2 commits intoOct 31, 2026
Merged
Conversation
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/62862 |
|
commit: |
nicolo-ribaudo
approved these changes
Oct 29, 2026
JLHwung
force-pushed
the
fix-parser-unparsed-contextual-escape
branch
from
October 29, 2026 14:47
f4745af to
783be78
Compare
`isUnparsedContextual` matched a name in the raw input when the next
character was not an IdentifierPart, but a backslash starts a `\u`
escape that continues the same IdentifierName: `function\u{61}` is the
identifier `functiona`, not the keyword `function`, and `using\u{61}` is
`usinga`. So `async function\u{61} f(){}` was parsed as an async function
declaration and `for (using of\u{61} = x;;);` was rejected although it is
a `using` declaration binding `ofa`.
Assisted-by: Claude Fable 5.1 <[email protected]>
JLHwung
force-pushed
the
fix-parser-unparsed-contextual-escape
branch
from
October 31, 2026 17:47
64d2e1f to
6eef881
Compare
liuxingbaoyu
approved these changes
Oct 31, 2026
Collaborator
|
Backported to 7.x in #18483. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
async function\u{61} f() {}In this PR we fix an issue reported by the Claude Fable: The
isUnparsedContextualmissed\escape when doing ad-hoc lookahead, and therefore it incorrectly considers\as the end of an identifier name, although\ucan continue.We also fixed a regression introduced in #17354: Currently throws a confusing error for
export type from\u{61} = number;: "Support for the experimental syntax 'exportDefaultFrom' isn't currently enabled" as the parser simply takesfromwithout checking the boundaries when expecting the flow/typescript plugin.