Skip to content

Commit b5e5e8c

Browse files
authored
perf(es/minifier): Remove needless clone (#10949)
1 parent 40a1e2e commit b5e5e8c

File tree

1 file changed

+5
-1
lines changed
  • crates/swc_ecma_usage_analyzer/src/analyzer

1 file changed

+5
-1
lines changed

crates/swc_ecma_usage_analyzer/src/analyzer/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,15 @@ where
9595
where
9696
F: FnOnce(&mut UsageAnalyzer<S>) -> Ret,
9797
{
98+
let used_recursively = std::mem::take(&mut self.used_recursively);
99+
98100
let mut child = UsageAnalyzer {
99101
data: S::new(S::need_collect_prop_atom(&self.data)),
100102
marks: self.marks,
101103
ctx: self.ctx.with(BitContext::IsTopLevel, false),
102104
expr_ctx: self.expr_ctx,
103105
scope: Default::default(),
104-
used_recursively: self.used_recursively.clone(),
106+
used_recursively,
105107
};
106108

107109
let ret = op(&mut child);
@@ -114,6 +116,8 @@ where
114116
self.scope.merge(child.scope, true);
115117
self.data.merge(kind, child.data);
116118

119+
self.used_recursively = child.used_recursively;
120+
117121
ret
118122
}
119123

0 commit comments

Comments
 (0)