Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/oxc_semantic/src/checker/javascript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ pub fn check_function_redeclaration(func: &Function, ctx: &SemanticBuilder<'_>)
let current_scope_flags = ctx.current_scope_flags();
if prev.flags.intersects(SymbolFlags::FunctionScopedVariable | SymbolFlags::Function)
&& (current_scope_flags.is_function()
|| current_scope_flags.is_class_static_block()
|| (!ctx.source_type.is_module() && current_scope_flags.is_top()))
{
// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames
Expand Down
16 changes: 1 addition & 15 deletions tasks/coverage/snapshots/parser_babel.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ commit: fc58af40

parser_babel Summary:
AST Parsed : 2221/2227 (99.73%)
Positive Passed: 2206/2227 (99.06%)
Positive Passed: 2207/2227 (99.10%)
Negative Passed: 1649/1689 (97.63%)
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2026/explicit-resource-management/invalid-for-using-of-no-initializer/input.js

Expand Down Expand Up @@ -84,20 +84,6 @@ Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/ty

Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/types/invalid-import-type-options-with-spread-element/input.ts

Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-static-block/duplicate-function-var-name/input.js

× Identifier `x` has already been declared
╭─[babel/packages/babel-parser/test/fixtures/es2022/class-static-block/duplicate-function-var-name/input.js:3:11]
2 │ static {
3 │ var x;
· ┬
· ╰── `x` has already been declared here
4 │ function x() {}
· ┬
· ╰── It can not be redeclared here
5 │ }
╰────

Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/top-level-await-unambiguous/module/input.js

× `await` is only allowed within async functions and at the top levels of modules
Expand Down
5 changes: 1 addition & 4 deletions tasks/coverage/snapshots/semantic_babel.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ commit: fc58af40

semantic_babel Summary:
AST Parsed : 2227/2227 (100.00%)
Positive Passed: 1940/2227 (87.11%)
Positive Passed: 1941/2227 (87.16%)
semantic Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/comments/decorators/decorators-after-export/input.js
Symbol span mismatch for "C":
after transform: SymbolId(0): Span { start: 65, end: 66 }
Expand Down Expand Up @@ -76,9 +76,6 @@ Symbol scope ID mismatch for "_await":
after transform: SymbolId(3): ScopeId(2)
rebuilt : SymbolId(2): ScopeId(0)

semantic Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-static-block/duplicate-function-var-name/input.js
Identifier `x` has already been declared

semantic Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/top-level-await-unambiguous/module/input.js
`await` is only allowed within async functions and at the top levels of modules

Expand Down
Loading