mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
fix(semantic): remove duplicate errors in ModuleDeclaration::ImportDeclaration (#1846)
<img width="653" alt="image" src="https://github.com/oxc-project/oxc/assets/29533304/7a3ca98e-6c6e-4170-8b79-e9c63b6b9153">
This commit is contained in:
parent
4c1673c2ca
commit
9c9d882d93
2 changed files with 0 additions and 19 deletions
|
|
@ -44,9 +44,6 @@ impl EarlyErrorJavaScript {
|
|||
AstKind::Directive(dir) => check_directive(dir, node, ctx),
|
||||
AstKind::ModuleDeclaration(decl) => {
|
||||
check_module_declaration(decl, node, ctx);
|
||||
if let ModuleDeclaration::ImportDeclaration(import_decl) = decl {
|
||||
check_import_declaration(import_decl, ctx);
|
||||
}
|
||||
}
|
||||
AstKind::MetaProperty(prop) => check_meta_property(prop, node, ctx),
|
||||
|
||||
|
|
@ -447,13 +444,6 @@ fn check_module_declaration<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
fn check_import_declaration(decl: &ImportDeclaration, ctx: &SemanticBuilder<'_>) {
|
||||
// ModuleItem : ImportDeclaration
|
||||
// It is a Syntax Error if the BoundNames of ImportDeclaration contains any duplicate entries.
|
||||
// bound_names are usually small, a simple loop should be more performant checking with a hashmap
|
||||
check_duplicate_bound_names(decl, ctx);
|
||||
}
|
||||
|
||||
fn check_meta_property<'a>(prop: &MetaProperty, node: &AstNode<'a>, ctx: &SemanticBuilder<'a>) {
|
||||
#[derive(Debug, Error, Diagnostic)]
|
||||
#[error("Unexpected new.target expression")]
|
||||
|
|
|
|||
|
|
@ -17970,15 +17970,6 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
|
|||
× Identifier `x` has already been declared
|
||||
╭─[language/import/dup-bound-names.js:15:1]
|
||||
15 │
|
||||
16 │ import { x, y as x } from 'z';
|
||||
· ┬ ┬
|
||||
· │ ╰── It can not be redeclared here
|
||||
· ╰── `x` has already been declared here
|
||||
╰────
|
||||
|
||||
× Identifier `x` has already been declared
|
||||
╭─[language/import/dup-bound-names.js:15:1]
|
||||
15 │
|
||||
16 │ import { x, y as x } from 'z';
|
||||
· ┬ ┬
|
||||
· │ ╰── It can not be redeclared here
|
||||
|
|
|
|||
Loading…
Reference in a new issue