-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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/compat): Handle shorthand object prop when rename #7176
Conversation
crates/swc/tests/tsc-references/intraExpressionInferences.1.normal.js
Outdated
Show resolved
Hide resolved
@@ -26,6 +26,26 @@ impl VisitMut for Rename { | |||
} | |||
} | |||
|
|||
fn visit_mut_prop(&mut self, n: &mut Prop) { | |||
let span = n.span(); | |||
if span.ctxt == SyntaxContext::empty() { |
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.
Should I omit this check logic?
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.
I think this logic can cause a problem
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.
Why did you add this logic?
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.
To skip prop which generated by ourselves.
I noticed that it's the reason caused the test result change.
I will correct it.
c: function(b) { | |
var x1 = b; | |
} |
swc/crates/swc_ecma_parser/tests/tsc/intraExpressionInferences.ts
Lines 98 to 100 in 6a05c20
c: (b) => { | |
const x: number = b; | |
} |
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_transforms_compat
@@ -26,6 +26,26 @@ impl VisitMut for Rename { | |||
} | |||
} | |||
|
|||
fn visit_mut_prop(&mut self, n: &mut Prop) { | |||
let span = n.span(); | |||
if span.ctxt == SyntaxContext::empty() { |
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.
I think this logic can cause a problem
@@ -26,6 +26,26 @@ impl VisitMut for Rename { | |||
} | |||
} | |||
|
|||
fn visit_mut_prop(&mut self, n: &mut Prop) { | |||
let span = n.span(); | |||
if span.ctxt == SyntaxContext::empty() { |
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.
Why did you add this logic?
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.
Thank you!
Description:
BREAKING CHANGE:
Related issue (if exists):