New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate __proto__
key should be allowed in object patterns
#10987
Conversation
__proto__
key should be allowed in object patterns__proto__
key should be allowed in object patterns
const { shorthandAssign } = refExpressionErrors; | ||
if (!andThrow) return shorthandAssign >= 0; | ||
if (shorthandAssign >= 0) { | ||
this.unexpected(shorthandAssign); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(In a separate PR)
Probably this error would be easily recoverable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I try to preserve the error output of shorthand assign error so it's indeed a refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This PR can be reviewed commit by commit.
The first commit is to replace
refShorthandDefaultPos
argument by a new general struct:refExpressionErrors
. By doing so we rebrand therefShorthandDefaultPos
into 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 propertydoubleProto
to therefExpressionErrors
and 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
parseMaybeAssign
to avoid regressions we have solved before.