Skip to content

Commit 7284b76

Browse files
committed
perf(semantic): inline enter_kind for FormalParameterRest (oxc-project#17403)
Ref oxc-project/backlog#72
1 parent 585ddf8 commit 7284b76

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

crates/oxc_semantic/src/builder.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2209,6 +2209,18 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
22092209
}
22102210
self.leave_node(kind);
22112211
}
2212+
2213+
fn visit_formal_parameter_rest(&mut self, param: &FormalParameterRest<'a>) {
2214+
let kind = AstKind::FormalParameterRest(self.alloc(param));
2215+
self.enter_node(kind);
2216+
param.bind(self);
2217+
self.visit_span(&param.span);
2218+
self.visit_binding_rest_element(&param.rest);
2219+
if let Some(type_annotation) = &param.type_annotation {
2220+
self.visit_ts_type_annotation(type_annotation);
2221+
}
2222+
self.leave_node(kind);
2223+
}
22122224
}
22132225

22142226
impl<'a> SemanticBuilder<'a> {
@@ -2230,9 +2242,6 @@ impl<'a> SemanticBuilder<'a> {
22302242
/* cfg */
22312243

22322244
match kind {
2233-
AstKind::FormalParameterRest(param) => {
2234-
param.bind(self);
2235-
}
22362245
AstKind::CatchParameter(param) => {
22372246
param.bind(self);
22382247
}

0 commit comments

Comments
 (0)