Skip to content

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Mar 2, 2025

Q                       A
Fixed Issues? When using legacy decorators, Babel parses var [@foo foo ] = foo; as decorator within an array pattern, which is not allowed.
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

Spot this issue when browsing through the lval implementation.

@JLHwung JLHwung added PR: Spec Compliance 👓 A type of pull request used for our changelog categories pkg: parser Spec: Decorators (Legacy) labels Mar 2, 2025
@babel-bot
Copy link
Collaborator

babel-bot commented Mar 2, 2025

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/58791

@@ -0,0 +1 @@
var [@foo foo ] = foo;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For stage 3 decorators, currently Babel throws a recoverable error message "Decorators cannot be used to decorate parameters.", which is quite confusing. Here we throw an unrecoverable error since we already do that for object patterns.

@JLHwung JLHwung force-pushed the disallow-decorator-in-array-pattern branch from d2701df to eda0d82 Compare March 2, 2025 03:17
@JLHwung JLHwung merged commit 62ed12a into babel:main Mar 2, 2025
55 checks passed
@JLHwung JLHwung deleted the disallow-decorator-in-array-pattern branch March 2, 2025 16:23
laine-hallot pushed a commit to laine-hallot/uwu-parser that referenced this pull request Mar 31, 2025
* type cleanup

* fix: disallow decorator in array pattern

* copy test cases to stage 3 decorators

* rename parseAssignableListItem to parseBindingElement

* incorrect test setup
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jun 2, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Spec Compliance 👓 A type of pull request used for our changelog categories Spec: Decorators (Legacy)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants