mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
parent
d22a9b72e0
commit
af6d240559
1 changed files with 12 additions and 9 deletions
|
|
@ -185,21 +185,23 @@ impl Rule for ConsistentFunctionScoping {
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
} else if let Some(function_id) = &function.id {
|
} else if let Some(function_id) = &function.id {
|
||||||
(function_id.symbol_id.get().unwrap(), function_body, function_id.span())
|
let Some(symbol_id) = function_id.symbol_id.get() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
(symbol_id, function_body, function_id.span())
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AstKind::ArrowFunctionExpression(arrow_function) if self.check_arrow_functions => {
|
AstKind::ArrowFunctionExpression(arrow_function) if self.check_arrow_functions => {
|
||||||
if let Some(binding_ident) = get_function_like_declaration(node, ctx) {
|
let Some(binding_ident) = get_function_like_declaration(node, ctx) else {
|
||||||
(
|
|
||||||
binding_ident.symbol_id.get().unwrap(),
|
|
||||||
&arrow_function.body,
|
|
||||||
binding_ident.span(),
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
return;
|
return;
|
||||||
}
|
};
|
||||||
|
let Some(symbol_id) = binding_ident.symbol_id.get() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
(symbol_id, &arrow_function.body, binding_ident.span())
|
||||||
}
|
}
|
||||||
_ => return,
|
_ => return,
|
||||||
};
|
};
|
||||||
|
|
@ -586,6 +588,7 @@ fn test() {
|
||||||
("module.exports = function foo() {};", None),
|
("module.exports = function foo() {};", None),
|
||||||
("module.exports.foo = function foo() {};", None),
|
("module.exports.foo = function foo() {};", None),
|
||||||
("foo.bar.func = function foo() {};", None),
|
("foo.bar.func = function foo() {};", None),
|
||||||
|
("if(f) function f(){}", None),
|
||||||
];
|
];
|
||||||
|
|
||||||
let fail = vec![
|
let fail = vec![
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue