mirror of
https://github.com/aphrody-labs/oxc.git
synced 2026-10-17 12:56:09 +00:00
perf(transformer): skip static block dispatch for ordinary statements (#27491)
Ordinary statements cannot contain the class declaration handled by ES2022 statement-entry dispatch. Check the statement kind before loading class-transform state, admitting only class declarations, export declarations, and default export declarations. Step 2 of 3 replacing #27446. Parent: #27489. Next: #27492. [Graphite stack](https://app.graphite.com/github/pr/oxc-project/oxc/27489). AI assistance was used for this change.
This commit is contained in:
1 parent
135dd04397
commit
cd9a62f6fa
1 file changed
+8
@@ -44,6 +44,14 @@ impl ES2022<'_> {
|
||||
|
||||
impl<'a> Traverse<'a, TransformState<'a>> for ES2022<'a> {
|
||||
fn enter_statement(&mut self, stmt: &mut Statement<'a>, ctx: &mut TraverseCtx<'a>) {
|
||||
if !matches!(
|
||||
stmt,
|
||||
Statement::ClassDeclaration(_)
|
||||
| Statement::ExportDeclaration(_)
|
||||
| Statement::ExportDefaultDeclaration(_)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if let Some(class_static_block) = &mut self.class_static_block {
|
||||
class_static_block.enter_statement(stmt, ctx);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user