mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
fix(eslint/no-obj-calls): should resolve non-global binding correctly (#745)
Fixes #744
This commit is contained in:
parent
5dc69ea4ec
commit
ec85fd8b7d
1 changed files with 8 additions and 4 deletions
|
|
@ -88,11 +88,13 @@ fn resolve_global_binding<'a, 'b: 'a>(
|
|||
let scope = ctx.scopes();
|
||||
let nodes = ctx.nodes();
|
||||
let symbols = ctx.symbols();
|
||||
scope.get_binding(scope_id, &ident.name).map_or_else(
|
||||
scope.ancestors(scope_id).find_map(|id| scope.get_binding(id, &ident.name)).map_or_else(
|
||||
|| {
|
||||
// panic!("No binding id found for {}, but this IdentifierReference
|
||||
// is not a global", &ident.name);
|
||||
None
|
||||
panic!(
|
||||
"No binding id found for {}, but this IdentifierReference
|
||||
is not a global",
|
||||
&ident.name
|
||||
);
|
||||
},
|
||||
|binding_id| {
|
||||
let decl = nodes.get_node(symbols.get_declaration(binding_id));
|
||||
|
|
@ -174,6 +176,8 @@ fn test() {
|
|||
}",
|
||||
None,
|
||||
),
|
||||
// https://github.com/web-infra-dev/oxc/pull/508#issuecomment-1618850742
|
||||
("{const Math = () => {}; {let obj = new Math();}}", None),
|
||||
];
|
||||
|
||||
let fail = vec![
|
||||
|
|
|
|||
Loading…
Reference in a new issue