Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions crates/oxc_transformer/src/es2015/arrow_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ impl<'a> ArrowFunctions<'a> {

fn get_this_name(&mut self, ctx: &mut TraverseCtx<'a>) -> BoundIdentifier<'a> {
if self.this_var.is_none() {
self.this_var = Some(BoundIdentifier::new_uid(
self.this_var = Some(BoundIdentifier::new_uid_in_current_scope(
"this",
ctx.current_scope_id(),
SymbolFlags::FunctionScopedVariable,
ctx,
));
Expand Down
10 changes: 10 additions & 0 deletions crates/oxc_transformer/src/helpers/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ impl<'a> BoundIdentifier<'a> {
Self::new_uid(name, scope_id, flags, ctx)
}

/// Create `BoundIdentifier` for new binding in current scope
pub fn new_uid_in_current_scope(
name: &str,
flags: SymbolFlags,
ctx: &mut TraverseCtx<'a>,
) -> Self {
let scope_id = ctx.current_scope_id();
Self::new_uid(name, scope_id, flags, ctx)
}

/// Create `BindingIdentifier` for this binding
pub fn create_binding_identifier(&self) -> BindingIdentifier<'a> {
BindingIdentifier {
Expand Down