Skip to content

Commit

Permalink
refactor(transformer/arrow-functions): reduce repeated code
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Jan 7, 2025
1 parent 1e65b59 commit 28469ba
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions crates/oxc_transformer/src/common/arrow_function_converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,12 +1141,8 @@ impl<'a> VisitMut<'a> for ConstructorBodyThisAfterSuperInserter<'a, '_> {
let mut new_stmts = vec![];

for (index, stmt) in statements.iter_mut().enumerate() {
let Statement::ExpressionStatement(expr_stmt) = stmt else {
self.visit_statement(stmt);
continue;
};

if expr_stmt.expression.is_super_call_expression() {
if matches!(stmt, Statement::ExpressionStatement(expr_stmt) if expr_stmt.expression.is_super_call_expression())
{
let assignment = self.create_assignment_to_this_temp_var();
let new_stmt = self.ctx.ast.statement_expression(SPAN, assignment);
new_stmts.push((index, new_stmt));
Expand Down

0 comments on commit 28469ba

Please sign in to comment.