mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
perf(semantic): just need to find the AstKind::FormalParameter in is_in_formal_parameters (#1852)
A bit of performance improvement <img width="894" alt="image" src="https://github.com/oxc-project/oxc/assets/29533304/ed687532-df83-4bd8-a893-059e41c8adf3">
This commit is contained in:
parent
0e0f25872f
commit
a743d06207
1 changed files with 1 additions and 1 deletions
|
|
@ -1089,7 +1089,7 @@ fn check_unary_expression<'a>(
|
||||||
fn is_in_formal_parameters<'a>(node: &AstNode<'a>, ctx: &SemanticBuilder<'a>) -> bool {
|
fn is_in_formal_parameters<'a>(node: &AstNode<'a>, ctx: &SemanticBuilder<'a>) -> bool {
|
||||||
for node_id in ctx.nodes.ancestors(node.id()).skip(1) {
|
for node_id in ctx.nodes.ancestors(node.id()).skip(1) {
|
||||||
match ctx.nodes.kind(node_id) {
|
match ctx.nodes.kind(node_id) {
|
||||||
AstKind::FormalParameters(_) => return true,
|
AstKind::FormalParameter(_) => return true,
|
||||||
AstKind::Program(_) | AstKind::Function(_) | AstKind::ArrowExpression(_) => break,
|
AstKind::Program(_) | AstKind::Function(_) | AstKind::ArrowExpression(_) => break,
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue