mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 20:28:58 +00:00
refactor(transformer/arrow-functions): reorder visitor methods (#8320)
Follow-on after #8024. Pure refactor. Re-order the methods of the `ConstructorBodyThisAfterSuperInserter` visitor. Intent is that the call path flows from top to bottom, so the "story" makes sense when you read the code starting from the top.
This commit is contained in:
parent
37199a4cd6
commit
ea9cefb5c3
1 changed files with 17 additions and 15 deletions
|
|
@ -1128,21 +1128,6 @@ impl<'a, 'v> ConstructorBodyThisAfterSuperInserter<'a, 'v> {
|
|||
fn new(this_var_binding: &'v BoundIdentifier<'a>, ctx: &'v mut TraverseCtx<'a>) -> Self {
|
||||
Self { this_var_binding, ctx }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn transform_super_call_expression(&mut self, expr: &Expression<'a>) -> Option<Expression<'a>> {
|
||||
if expr.is_super_call_expression() {
|
||||
let assignment = self.ctx.ast.expression_assignment(
|
||||
SPAN,
|
||||
AssignmentOperator::Assign,
|
||||
self.this_var_binding.create_write_target(self.ctx),
|
||||
self.ctx.ast.expression_this(SPAN),
|
||||
);
|
||||
Some(assignment)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> VisitMut<'a> for ConstructorBodyThisAfterSuperInserter<'a, '_> {
|
||||
|
|
@ -1188,3 +1173,20 @@ impl<'a> VisitMut<'a> for ConstructorBodyThisAfterSuperInserter<'a, '_> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ConstructorBodyThisAfterSuperInserter<'a, '_> {
|
||||
#[inline]
|
||||
fn transform_super_call_expression(&mut self, expr: &Expression<'a>) -> Option<Expression<'a>> {
|
||||
if expr.is_super_call_expression() {
|
||||
let assignment = self.ctx.ast.expression_assignment(
|
||||
SPAN,
|
||||
AssignmentOperator::Assign,
|
||||
self.this_var_binding.create_write_target(self.ctx),
|
||||
self.ctx.ast.expression_this(SPAN),
|
||||
);
|
||||
Some(assignment)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue