From 84fb416ab84fca5fa1c1af80a7d355c2ea08eb60 Mon Sep 17 00:00:00 2001 From: CPunisher <1343316114@qq.com> Date: Fri, 5 Jul 2024 20:10:04 +0800 Subject: [PATCH] Clean code --- .../swc_ecma_compat_es2015/src/block_scoping/mod.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/crates/swc_ecma_compat_es2015/src/block_scoping/mod.rs b/crates/swc_ecma_compat_es2015/src/block_scoping/mod.rs index 7ed357913260..0307eea8562f 100644 --- a/crates/swc_ecma_compat_es2015/src/block_scoping/mod.rs +++ b/crates/swc_ecma_compat_es2015/src/block_scoping/mod.rs @@ -99,6 +99,8 @@ impl BlockScoping { } fn mark_as_used(&mut self, i: Id) { + // Only consider the variable used in a non-ScopeKind::Loop, which means it is + // captured in a closure for scope in self .scope .iter_mut() @@ -127,16 +129,6 @@ impl BlockScoping { fn handle_capture_of_vars(&mut self, body: &mut Box) { let body_stmt = &mut **body; - // { - // let mut v = FunctionFinder { found: false }; - // body_stmt.visit_with(&mut v); - // if !v.found { - // self.scope.pop(); - // return; - // } - // } - - // if let Some(ScopeKind::Loop { args, used,