refactor(transformer): comment about potential improvement to arrow function transform (#5841)

This commit is contained in:
overlookmotel 2024-09-18 02:23:36 +00:00
parent 635e9187d3
commit 03e02a0eac

View file

@ -246,6 +246,10 @@ impl<'a> ArrowFunctions<'a> {
span: Span,
ctx: &mut TraverseCtx<'a>,
) -> IdentifierReference<'a> {
// TODO(improve-on-babel): We create a new UID for every scope. This is pointless, as only one
// `this` can be in scope at a time. We could create a single `_this` UID and reuse it in each
// scope. But this does not match output for some of Babel's test cases.
// <https://github.com/oxc-project/oxc/pull/5840>
let this_var = self.this_var_stack.last_mut().unwrap();
if this_var.is_none() {
let target_scope_id =