Skip to content

Commit

Permalink
perf(transformer/arrow-function): stop traversal at function as super…
Browse files Browse the repository at this point in the history
…() can't appear in a nested function
  • Loading branch information
Dunqing committed Jan 9, 2025
1 parent cd616dc commit a94d57c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/oxc_transformer/src/common/arrow_function_converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1195,9 +1195,11 @@ impl<'a> VisitMut<'a> for ConstructorBodyThisAfterSuperInserter<'a, '_> {
}
}
}
// TODO: Stop traversal at a `Function` too. `super()` can't appear in a nested function,
// so no point traversing it. This is for performance, not correctness.

#[inline] // `#[inline]` because is a no-op
fn visit_function(&mut self, _func: &mut Function<'a>, _flags: ScopeFlags) {
// `super()` can't appear in a nested function
}

/// `super()` -> `super(); _this = this;`
fn visit_statements(&mut self, statements: &mut ArenaVec<'a, Statement<'a>>) {
Expand Down

0 comments on commit a94d57c

Please sign in to comment.