From 03a9e1ad5deb8fe62c4ec247194bca06fb0adade Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Wed, 18 Sep 2024 02:23:34 +0000 Subject: [PATCH] refactor(transformer): reorder methods in arrow function transform (#5830) Pure refactor. Just move methods which push/pop to stacks to the top, so they're all together. --- .../src/es2015/arrow_functions.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/oxc_transformer/src/es2015/arrow_functions.rs b/crates/oxc_transformer/src/es2015/arrow_functions.rs index 04ed071e4..e281d50a9 100644 --- a/crates/oxc_transformer/src/es2015/arrow_functions.rs +++ b/crates/oxc_transformer/src/es2015/arrow_functions.rs @@ -160,6 +160,14 @@ impl<'a> Traverse<'a> for ArrowFunctions<'a> { self.inside_arrow_function_stack.pop().unwrap(); } + fn enter_class(&mut self, _class: &mut Class<'a>, _ctx: &mut TraverseCtx<'a>) { + self.inside_arrow_function_stack.push(false); + } + + fn exit_class(&mut self, _class: &mut Class<'a>, _ctx: &mut TraverseCtx<'a>) { + self.inside_arrow_function_stack.pop().unwrap(); + } + fn enter_jsx_element_name( &mut self, element_name: &mut JSXElementName<'a>, @@ -213,14 +221,6 @@ impl<'a> Traverse<'a> for ArrowFunctions<'a> { } } - fn enter_class(&mut self, _class: &mut Class<'a>, _ctx: &mut TraverseCtx<'a>) { - self.inside_arrow_function_stack.push(false); - } - - fn exit_class(&mut self, _class: &mut Class<'a>, _ctx: &mut TraverseCtx<'a>) { - self.inside_arrow_function_stack.pop().unwrap(); - } - fn enter_variable_declarator( &mut self, node: &mut VariableDeclarator<'a>,