-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix(es/utils): Fix regression of RefRewriter
#8153
Conversation
cc @magic-akari Can you take a look? |
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.
swc-bump:
- swc_ecma_utils
cc @magic-akari Is this the correct fix? |
commonjs
passRefRewriter
swc/crates/swc_ecma_utils/src/lib.rs Lines 3070 to 3079 in cea140e
The key issue here is that we hope that when we access Pat::Ident, we get the Ident ref, not the ident decl var a = "value-a", b = "value-b"; // var declaration
// ^^^ decl ^^^ decl
var { [a]: d, c } = { "value-a": 1, b }; // var declaration
// | | ^^^ decl ^^^ ref
// | |- decl
// |
// |-- ref
var [e = a] = [a]; // var declaration
// | ^^^ ref ^^^ ref
// |- decl
[b] = [1], { [a]: d } = { "value-a": 1 }; // assignment expression
// ^^^ ref ^^ref ^^ref I think that the Pat in a declaration name and the Pat in an assignment expression are different. Maybe we should wrap all ident ref cases in an IdentRef struct #8074. |
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.
Automated review comment generated by auto-rebase script
### What? Update SWC crates. This PR fixes a regression of `swc_core`. The important PR: swc-project/swc#8153 ### Why? There was a regression in `swc_core`. ### How? - Fixes #56408 Closes WEB-1811 --------- Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Description:
Related issue: