From edc6fa4830918021bc4e7ee5ff4857e2ea966939 Mon Sep 17 00:00:00 2001 From: Dunqing Date: Mon, 18 Dec 2023 11:26:33 +0800 Subject: [PATCH] feat(semantic): add SymbolFlags::Function for FunctionDeclaration (#1713) Co-authored-by: Boshen --- crates/oxc_semantic/src/binder.rs | 5 ++++- crates/oxc_semantic/tests/symbols.rs | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/oxc_semantic/src/binder.rs b/crates/oxc_semantic/src/binder.rs index 029380ab5..82791187a 100644 --- a/crates/oxc_semantic/src/binder.rs +++ b/crates/oxc_semantic/src/binder.rs @@ -122,7 +122,10 @@ impl<'a> Binder for Function<'a> { if (parent_flags.is_strict_mode() || self.r#async || self.generator) && !function_as_var(parent_flags, builder.source_type) { - (SymbolFlags::BlockScopedVariable, SymbolFlags::BlockScopedVariableExcludes) + ( + SymbolFlags::Function | SymbolFlags::BlockScopedVariable, + SymbolFlags::BlockScopedVariableExcludes, + ) } else { ( SymbolFlags::FunctionScopedVariable, diff --git a/crates/oxc_semantic/tests/symbols.rs b/crates/oxc_semantic/tests/symbols.rs index 65f0b7774..c053da081 100644 --- a/crates/oxc_semantic/tests/symbols.rs +++ b/crates/oxc_semantic/tests/symbols.rs @@ -18,7 +18,6 @@ fn test_class_simple() { .test(); } -#[ignore = "function symbols currently lack SymbolFlags::Function"] #[test] fn test_function_simple() { SemanticTester::js("function foo() { return }")