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 (#8383)
  • Loading branch information
Dunqing authored and overlookmotel committed Jan 10, 2025
1 parent fd35866 commit 07edf74
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/oxc_transformer/src/common/arrow_function_converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,8 +1209,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 07edf74

Please sign in to comment.