swc_ecma_minifier/compress/pure/
unsafes.rs1use swc_ecma_ast::*;
2use swc_ecma_utils::ExprExt;
3
4use super::Pure;
5
6impl Pure<'_> {
7 pub(super) fn drop_arguments_of_symbol_call(&mut self, e: &mut CallExpr) {
9 if !self.options.unsafe_symbols {
10 return;
11 }
12
13 match &e.callee {
14 Callee::Super(_) | Callee::Import(_) => return,
15 Callee::Expr(callee) => match &**callee {
16 Expr::Ident(Ident { sym, .. }) if &**sym == "Symbol" => {}
17 _ => return,
18 },
19 #[cfg(swc_ast_unknown)]
20 _ => panic!("unable to access unknown nodes"),
21 }
22
23 e.args
24 .retain(|arg| arg.expr.may_have_side_effects(self.expr_ctx));
25 }
26}