mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
refactor(transformer/arrow-functions): reduce repeated code (#8323)
Follow-on after #8024. Pure refactor. Make `self.visit_statement(stmt)` only get called in one place, rather than 2.
This commit is contained in:
parent
62e3f7e525
commit
73d0025a75
1 changed files with 2 additions and 6 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in a new issue