Skip to content

Commit

Permalink
fix(linter): fix panic in import/namespace (#4080)
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Jul 7, 2024
1 parent 54b3b6c commit 7b2dc3b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions crates/oxc_linter/src/rules/import/namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,17 @@ fn check_deep_namespace_for_node(
let Some(parent_node) = ctx.nodes().parent_node(node.id()) else {
return;
};

let mut namespaces = namespaces.to_owned();
namespaces.push(name.into());
check_deep_namespace_for_node(
parent_node,
source,
namespaces.as_slice(),
module.loaded_modules.get(module_source.as_str()).unwrap().value(),
ctx,
);
if let Some(module_record) = module.loaded_modules.get(module_source.as_str()) {
let mut namespaces = namespaces.to_owned();
namespaces.push(name.into());
check_deep_namespace_for_node(
parent_node,
source,
&namespaces,
module_record.value(),
ctx,
);
}
} else {
check_binding_exported(
name,
Expand Down

0 comments on commit 7b2dc3b

Please sign in to comment.