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
Refactor bindingProperty parsing #13929
Conversation
@@ -0,0 +1 @@ | |||
var { @foo foo } = foo; |
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.
The current main incorrectly allows decorators in pattern. This is now fixed, by not handling decorators at all in parseBindingProperty
.
class A { | ||
+#foo; | ||
-#foo; | ||
} |
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.
The current main incorrectly parses +#foo
as ClassProperty
instead of ClassPrivateProperty
. This is now fixed by a new parsePropertyNamePrefixOperator
hook for the Flow plugin.
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/49687/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 2efdbf8:
|
@@ -1,3 +1,3 @@ | |||
class C { | |||
#p = ({ #x: 42 }); |
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 file is renamed to invalid-object-property/input.js
.
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
fafff94
to
647ecd4
Compare
They are always non-ambiguous.
a28cfbc
to
2efdbf8
Compare
The PR is extracted from my local working branch on destructuring private parsing.
parseMaybePrivateName
is inlined toparsePropertyName
parseBindingProperty
is extracted fromparsePropertyDefinition
parseClassElementName
, since we already checkedprivateName
to throw private constructor error. TheparsePropertyName
now always throws private name in object. In the future it will handle the ambiguous({ #x: x })
.Two bugs are fixed during refactoring.