Duplicate __proto__ key should be allowed in object patterns#10987
Merged
JLHwung merged 4 commits intobabel:masterfrom Jan 15, 2020
Merged
Duplicate __proto__ key should be allowed in object patterns#10987JLHwung merged 4 commits intobabel:masterfrom
__proto__ key should be allowed in object patterns#10987JLHwung merged 4 commits intobabel:masterfrom
Conversation
__proto__ key should be allowed in object patterns__proto__ key should be allowed in object patterns
nicolo-ribaudo
approved these changes
Jan 13, 2020
| const { shorthandAssign } = refExpressionErrors; | ||
| if (!andThrow) return shorthandAssign >= 0; | ||
| if (shorthandAssign >= 0) { | ||
| this.unexpected(shorthandAssign); |
Member
There was a problem hiding this comment.
(In a separate PR)
Probably this error would be easily recoverable.
Contributor
Author
There was a problem hiding this comment.
Yeah, I try to preserve the error output of shorthand assign error so it's indeed a refactor.
This was referenced Feb 24, 2020
This was referenced Mar 7, 2020
This was referenced Mar 14, 2020
This was referenced Mar 25, 2020
This was referenced Apr 2, 2020
This was referenced Apr 9, 2020
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR can be reviewed commit by commit.
The first commit is to replace
refShorthandDefaultPosargument by a new general struct:refExpressionErrors. By doing so we rebrand therefShorthandDefaultPosinto a context variable within the expression scope.This paves the way to fix the duplicate
__proto__tracking issue: In the second commit we add a new propertydoublePrototo therefExpressionErrorsand reset if we are sure the parsed ambiguous object patterns is indeed a LHS.I have definitely borrowed a lot from acorn's design but carefully crafted
parseMaybeAssignto avoid regressions we have solved before.