Repository navigation
fix: start recovered AssignmentPattern at the property key - #18603
Merged
JLHwung merged 1 commit intoNov 12, 2026
Merged
Conversation
When errorRecovery is true, `class C m({a=1})` produces an ObjectProperty whose AssignmentPattern starts from the token "=".
An assignment pattern should start from the object property name `a`, here it started from "=" because the startLoc was only updated when refExpressionsErrors are null. parseMaybeDefault then fallback to start the AssignmentPattern at the current token "=" position.
Always record the property start so the pattern starts at the key, as it
already did for `({a=1})`, `f({a=1})` and `[{a=1}]`.
Assisted-by: Claude Fable 5.1
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/63257 |
|
commit: |
nicolo-ribaudo
approved these changes
Nov 12, 2026
JLHwung
deleted the
jlhwung/fix-parser-recovery-assignment-pattern-start
branch
November 12, 2026 14:27
Collaborator
|
Backported to 7.x in #18609. |
JLHwung
added a commit
that referenced
this pull request
Nov 12, 2026
JLHwung
pushed a commit
that referenced
this pull request
Nov 12, 2026
Co-authored-by: Copilot <[email protected]>
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.
When errorRecovery is true,
class C m({a=1}) {}produces an ObjectProperty whose AssignmentPattern starts from the token "=".An assignment pattern should start from the object property name
a, here it started from "=" because the startLoc was only updated when refExpressionsErrors are non-null. parseMaybeDefault then fallback to start the AssignmentPattern at the current token "=" position.Always record the property start so the pattern starts at the key, as it already did for
({a=1}),f({a=1})and[{a=1}].Assisted-by: Claude Fable 5.1