Skip to content

Commit

Permalink
perf(codegen): remove useless to_owned (#8014)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Dec 19, 2024
1 parent 7b70347 commit 862838f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/oxc_codegen/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2040,15 +2040,15 @@ impl Gen for AssignmentTargetProperty<'_> {

impl Gen for AssignmentTargetPropertyIdentifier<'_> {
fn gen(&self, p: &mut Codegen, ctx: Context) {
let ident_name = p.get_identifier_reference_name(&self.binding).to_owned();
let ident_name = p.get_identifier_reference_name(&self.binding);
if ident_name == self.binding.name.as_str() {
self.binding.print(p, ctx);
} else {
// `({x: a} = y);`
p.print_str(self.binding.name.as_str());
p.print_colon();
p.print_soft_space();
p.print_str(&ident_name);
p.print_str(ident_name);
}
if let Some(expr) = &self.init {
p.print_soft_space();
Expand Down

0 comments on commit 862838f

Please sign in to comment.