perf(transformer): skip ES2022 exits for non-class expressions (#27489)

Both ES2022 expression-exit transforms only affect class expressions. Return before reading class-transform state for every other expression kind.

Step 1 of 3 replacing #27446. Parent: main. Next: #27491. [Graphite stack](https://app.graphite.com/github/pr/oxc-project/oxc/27489).

AI assistance was used for this change.
This commit is contained in:
camc314 committed 2026-10-10 03:37:23 +00:00
1 parent 72bf06fc61
commit 135dd04397
1 file changed
+3
+3
View File
@@ -66,6 +66,9 @@ impl<'a> Traverse<'a, TransformState<'a>> for ES2022<'a> {
}
fn exit_expression(&mut self, expr: &mut Expression<'a>, ctx: &mut TraverseCtx<'a>) {
if !matches!(expr, Expression::ClassExpression(_)) {
return;
}
if let Some(class_properties) = &mut self.class_properties {
class_properties.exit_expression(expr, ctx);
} else if let Some(class_static_block) = &mut self.class_static_block {