refactor(transformer): HelperLoader common transform: remove Rcs (#6564)

State is uniquely owned by `HelperLoaderStore`, so no need for `Rc`.
This commit is contained in:
overlookmotel 2024-10-15 01:20:31 +00:00
parent 1c1e9fc2c4
commit 50ecade892

View file

@ -62,7 +62,6 @@
use std::{ use std::{
borrow::Cow, borrow::Cow,
cell::{Cell, RefCell}, cell::{Cell, RefCell},
rc::Rc,
}; };
use oxc_allocator::Vec; use oxc_allocator::Vec;
@ -154,9 +153,9 @@ pub struct HelperLoaderStore<'a> {
mode: HelperLoaderMode, mode: HelperLoaderMode,
module_name: Cow<'static, str>, module_name: Cow<'static, str>,
/// Symbol ID for the `babelHelpers`. /// Symbol ID for the `babelHelpers`.
babel_helpers_symbol_id: Rc<Cell<Option<SymbolId>>>, babel_helpers_symbol_id: Cell<Option<SymbolId>>,
/// Loaded helpers, determined what helpers are loaded and what imports should be added. /// Loaded helpers, determined what helpers are loaded and what imports should be added.
loaded_helpers: Rc<RefCell<LoadedHelper<'a>>>, loaded_helpers: RefCell<LoadedHelper<'a>>,
} }
// Public methods // Public methods
@ -165,8 +164,8 @@ impl<'a> HelperLoaderStore<'a> {
Self { Self {
mode: options.mode, mode: options.mode,
module_name: options.module_name.clone(), module_name: options.module_name.clone(),
loaded_helpers: Rc::new(RefCell::new(FxHashMap::default())), loaded_helpers: RefCell::new(FxHashMap::default()),
babel_helpers_symbol_id: Rc::new(Cell::new(None)), babel_helpers_symbol_id: Cell::new(None),
} }
} }