Skip to content

Commit 831eed5

Browse files
authored
fix(es/minifier): Fix compile error with debug feature (#10999)
**Description:** Sorry, I didn't notice that in #10997 because the github code doesn't show the affected code
1 parent 1bb3716 commit 831eed5

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

crates/swc_ecma_minifier/src/compress/optimize/iife.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,11 +646,17 @@ impl Optimizer<'_> {
646646
.iter()
647647
.map(|p| &p.pat.as_ident().unwrap().id);
648648

649+
#[cfg(feature = "debug")]
650+
let param_ids_for_debug = param_ids.clone();
651+
649652
let new =
650653
self.inline_fn_like(param_ids, f.function.params.len(), body, &mut call.args);
651654
if let Some(new) = new {
652655
self.changed = true;
653-
report_change!("inline: Inlining a function call (params = {param_ids:?})");
656+
report_change!(
657+
"inline: Inlining a function call (params = {:?})",
658+
param_ids_for_debug
659+
);
654660

655661
dump_change_detail!("{}", dump(&new, false));
656662

@@ -1152,7 +1158,7 @@ impl Optimizer<'_> {
11521158

11531159
fn inline_fn_like_stmt<'a>(
11541160
&mut self,
1155-
params: impl Iterator<Item = &'a Ident> + Clone,
1161+
params: impl Iterator<Item = &'a Ident> + Clone + std::fmt::Debug,
11561162
params_len: usize,
11571163
body: &mut BlockStmt,
11581164
args: &mut [ExprOrSpread],

crates/swc_ecma_minifier/src/compress/optimize/inline.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ impl Optimizer<'_> {
805805
}
806806

807807
match &decl {
808-
Decl::Class(_) => {
808+
Decl::Class(_c) => {
809809
if self.options.inline != 3
810810
|| self.options.keep_classnames
811811
|| self.mangle_options.is_some_and(|v| v.keep_class_names)
@@ -817,11 +817,11 @@ impl Optimizer<'_> {
817817
self.changed = true;
818818
report_change!(
819819
"inline: Decided to inline class `{}{:?}` as it's used only once",
820-
c.ident.sym,
821-
c.ident.ctxt
820+
_c.ident.sym,
821+
_c.ident.ctxt
822822
);
823823
}
824-
Decl::Fn(_) => {
824+
Decl::Fn(_f) => {
825825
if self.options.keep_fnames
826826
|| self.mangle_options.is_some_and(|v| v.keep_fn_names)
827827
{
@@ -832,8 +832,8 @@ impl Optimizer<'_> {
832832
self.changed = true;
833833
report_change!(
834834
"inline: Decided to inline function `{}{:?}` as it's used only once",
835-
f.ident.sym,
836-
f.ident.ctxt
835+
_f.ident.sym,
836+
_f.ident.ctxt
837837
);
838838
}
839839
_ => {}

0 commit comments

Comments
 (0)