-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix(es/compat): Fix loose mode of the spread
pass
#7608
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
Conversation
@kdy1 Sorry to push code without tests. I'm new to this repo🥹, kind of confused where I can complete whole testing process. I noticed we can write |
You can do |
Also, can you sign the CLA? |
CI is failing. You can update snapshots with |
@kdy1 Thank you for the reminder :) I'm going to working on this pr today. Updating the Snapshots. |
bb8dc90
to
7af6eb3
Compare
Hello @kdy1 , I update the testing file and snapshots. Could you please help me check the code? |
for arg in args { | ||
if let Some(arg) = arg { | ||
let ExprOrSpread { expr, spread } = arg; | ||
arg_list.push(expr.clone().as_arg()); |
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 clone seems redundant.
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.
expr
used without clone
method will cause use of moved value
error in next *expr
location.
Error stack is as follows.
error[E0382]: use of moved value: `*expr`
--> crates/swc_ecma_transforms_compat/src/es2015/spread.rs:286:34
|
258 | arg_list.push(expr.as_arg());
| -------- `*expr` moved due to this method call
...
286 | buf.push(match *expr {
| ^^^^^^^^^^^ value used here after move
|
= note: move occurs because `*expr` has type `swc_ecma_ast::Expr`, which does not implement the `Copy` trait
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
258 | arg_list.push(expr.clone().as_arg());
| ++++++++
For more information about this error, try `rustc --explain E0382`.
error: could not compile `swc_ecma_transforms_compat` (lib) due to previous error
$ rustc --version
rustc 1.70.0-nightly (da7c50c08 2023-03-19)
Thanks for the CR yesterday @kdy1 , is there anything I can do with this PR? |
Please remove the redundant clone. It's removable |
Good afternoon ☕️ @kdy1 I've removed the redundant |
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
spread
pass
Description:
Related issue: