Skip to content

Commit

Permalink
refactor(transformer/class-properties): do not pass ScopeId into `i…
Browse files Browse the repository at this point in the history
…nsert_instance_inits`
  • Loading branch information
overlookmotel committed Dec 18, 2024
1 parent 0ed4a9f commit 766179d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
class,
instance_inits,
&instance_inits_insert_location,
self.instance_inits_scope_id,
constructor_index,
ctx,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,11 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
}

/// Insert instance property initializers.
///
/// `scope_id` has different meaning depending on type of `insertion_location`.
pub(super) fn insert_instance_inits(
&mut self,
class: &mut Class<'a>,
inits: Vec<Expression<'a>>,
insertion_location: &InstanceInitsInsertLocation<'a>,
scope_id: ScopeId,
constructor_index: usize,
ctx: &mut TraverseCtx<'a>,
) {
Expand All @@ -225,7 +222,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {

match insertion_location {
InstanceInitsInsertLocation::NewConstructor => {
Self::insert_constructor(class, scope_id, inits, ctx);
Self::insert_constructor(class, self.instance_inits_scope_id, inits, ctx);
}
InstanceInitsInsertLocation::ExistingConstructor(stmt_index) => {
self.insert_inits_into_constructor_as_statements(
Expand All @@ -241,13 +238,18 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
class,
inits,
super_binding,
scope_id,
self.instance_inits_scope_id,
constructor_index,
ctx,
);
}
InstanceInitsInsertLocation::SuperFnOutsideClass(super_binding) => {
self.create_super_function_outside_constructor(inits, super_binding, scope_id, ctx);
self.create_super_function_outside_constructor(
inits,
super_binding,
self.instance_inits_scope_id,
ctx,
);
}
}
}
Expand Down

0 comments on commit 766179d

Please sign in to comment.