From 7c2d868dc701246d480e6f9a4b2d174f6b3d3e58 Mon Sep 17 00:00:00 2001 From: Dunqing Date: Sat, 17 Feb 2024 21:02:45 +0800 Subject: [PATCH] refactor(semantic): delete the redundant code in binder (#2423) --- crates/oxc_semantic/src/binder.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/oxc_semantic/src/binder.rs b/crates/oxc_semantic/src/binder.rs index 5249055a5..2d8b6e538 100644 --- a/crates/oxc_semantic/src/binder.rs +++ b/crates/oxc_semantic/src/binder.rs @@ -43,11 +43,10 @@ impl<'a> Binder for VariableDeclarator<'a> { let mut var_scope_ids = vec![]; if !builder.current_scope_flags().is_var() { for scope_id in builder.scope.ancestors(current_scope_id).skip(1) { + var_scope_ids.push(scope_id); if builder.scope.get_flags(scope_id).is_var() { - var_scope_ids.push(scope_id); break; } - var_scope_ids.push(scope_id); } } @@ -60,10 +59,7 @@ impl<'a> Binder for VariableDeclarator<'a> { builder.check_redeclaration(*scope_id, span, name, excludes, true) { ident.symbol_id.set(Some(symbol_id)); - if self.kind.is_var() { - builder - .add_redeclared_variables(VariableInfo { span: ident.span, symbol_id }); - } + builder.add_redeclared_variables(VariableInfo { span: ident.span, symbol_id }); return; } }