From 03e02a0eacc29ec8b2c6c65949621216ad4caf3a Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Wed, 18 Sep 2024 02:23:36 +0000 Subject: [PATCH] refactor(transformer): comment about potential improvement to arrow function transform (#5841) --- crates/oxc_transformer/src/es2015/arrow_functions.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/oxc_transformer/src/es2015/arrow_functions.rs b/crates/oxc_transformer/src/es2015/arrow_functions.rs index ccae51720d3e0..82c4d54d9b535 100644 --- a/crates/oxc_transformer/src/es2015/arrow_functions.rs +++ b/crates/oxc_transformer/src/es2015/arrow_functions.rs @@ -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. + // let this_var = self.this_var_stack.last_mut().unwrap(); if this_var.is_none() { let target_scope_id =