From bde1e67323eb24188f2a6c06c7155c7aa57b8710 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Wed, 18 Dec 2024 23:08:09 +0000 Subject: [PATCH] Don't wrap class expression in sequence expr if not needed --- .../oxc_transformer/src/es2022/class_properties/class.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/oxc_transformer/src/es2022/class_properties/class.rs b/crates/oxc_transformer/src/es2022/class_properties/class.rs index 6397b77e48a94f..d930b4795076ed 100644 --- a/crates/oxc_transformer/src/es2022/class_properties/class.rs +++ b/crates/oxc_transformer/src/es2022/class_properties/class.rs @@ -413,8 +413,12 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { expr_count += private_props.len(); } - // TODO: Why is this assertion failing sometimes? - // debug_assert!(expr_count > 0); + // TODO: Refactor + if expr_count == 0 { + debug_assert!(class_details.bindings.temp.is_none()); + self.classes_stack.pop(); + return; + } expr_count += 1 + usize::from(class_details.bindings.temp.is_some());