how to migrate from visit_mut_with to Pass?

I'm upgrading the swc dependency for the qwik optimizer (https://github.com/QwikDev/qwik/blob/2ed63b78bd4a20b0f96b4e6fba9ae396916f2321/packages/qwik/src/optimizer/core/src/parse.rs#L266) and it looks like I need to convert
program.visit_mut_with(&mut typescript::strip(
Default::default(),
top_level_mark,
))
program.visit_mut_with(&mut typescript::strip(
Default::default(),
top_level_mark,
))
to
program.apply(&mut typescript::strip(Default::default(), top_level_mark));
program.apply(&mut typescript::strip(Default::default(), top_level_mark));
but then further down I get use of moved value for program Furthermore, we use simplifier on Module but that latter doesn't have apply
segment_module =
segment_module.fold_with(&mut simplify::simplifier(
unresolved_mark,
simplify::Config {
dce: simplify::dce::Config {
preserve_imports_with_side_effects: false,
..Default::default()
},
..Default::default()
},
));
segment_module =
segment_module.fold_with(&mut simplify::simplifier(
unresolved_mark,
simplify::Config {
dce: simplify::dce::Config {
preserve_imports_with_side_effects: false,
..Default::default()
},
..Default::default()
},
));
Any help or pointers would be greatly appreciated.
GitHub
qwik/packages/qwik/src/optimizer/core/src/parse.rs at 2ed63b78bd4a2...
Instant-loading web apps, without effort. Contribute to QwikDev/qwik development by creating an account on GitHub.
2 Replies
kdy1
kdy12w ago
You can use program.mutate For module, you can still use ‘visit_mut’. Alternatively you can construct Program by doing Program::Module(m) and doing expect_module
Want results from more Discord servers?
Add your server