Skip to content

Commit b4fa94a

Browse files
committed
fix build
1 parent 46b2371 commit b4fa94a

File tree

1 file changed

+14
-12
lines changed
  • crates/swc_ecma_minifier/src/compress

1 file changed

+14
-12
lines changed

crates/swc_ecma_minifier/src/compress/mod.rs

+14-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use std::fmt::{self, Debug, Display, Formatter};
33
#[cfg(feature = "debug")]
44
use std::thread;
5-
use std::{borrow::Cow, fmt::Write, time::Instant};
5+
use std::{borrow::Cow, fmt::Write, mem::transmute, time::Instant};
66

77
#[cfg(feature = "pretty_assertions")]
88
use pretty_assertions::assert_eq;
@@ -24,7 +24,7 @@ use crate::{
2424
debug::{dump, AssertValid},
2525
mode::Mode,
2626
option::{CompressOptions, MangleOptions},
27-
program_data::analyze,
27+
program_data::{analyze, ProgramData},
2828
util::{force_dump_program, now},
2929
};
3030

@@ -266,17 +266,19 @@ impl Compressor<'_> {
266266
//
267267
// This is swc version of `node.optimize(this);`.
268268

269-
let mut visitor = optimizer(
270-
self.marks,
271-
self.options,
272-
self.mangle_options,
273-
&mut data,
274-
self.mode,
275-
!self.dump_for_infinite_loop.is_empty(),
276-
);
277-
n.visit_mut_with(&mut visitor);
269+
{
270+
let mut visitor = optimizer(
271+
self.marks,
272+
self.options,
273+
self.mangle_options,
274+
unsafe { transmute::<&mut ProgramData, &mut ProgramData>(&mut data) },
275+
self.mode,
276+
!self.dump_for_infinite_loop.is_empty(),
277+
);
278+
n.visit_mut_with(&mut visitor);
278279

279-
self.changed |= visitor.changed();
280+
self.changed |= visitor.changed();
281+
}
280282

281283
// let done = dump(&*n);
282284
// debug!("===== Result =====\n{}", done);

0 commit comments

Comments
 (0)