mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(hir): use Cell for SymbolId instead of RefCell
This commit is contained in:
parent
d30735677b
commit
527b94fba6
2 changed files with 5 additions and 5 deletions
|
|
@ -1,5 +1,5 @@
|
|||
use std::{
|
||||
cell::RefCell,
|
||||
cell::Cell,
|
||||
fmt,
|
||||
hash::{Hash, Hasher},
|
||||
};
|
||||
|
|
@ -407,7 +407,7 @@ pub struct IdentifierReference {
|
|||
pub span: Span,
|
||||
pub name: Atom,
|
||||
#[cfg_attr(feature = "serde", serde(skip))]
|
||||
pub reference_id: RefCell<ReferenceId>,
|
||||
pub reference_id: Cell<ReferenceId>,
|
||||
}
|
||||
|
||||
impl Hash for IdentifierReference {
|
||||
|
|
@ -424,7 +424,7 @@ pub struct BindingIdentifier {
|
|||
pub span: Span,
|
||||
pub name: Atom,
|
||||
#[cfg_attr(feature = "serde", serde(skip))]
|
||||
pub symbol_id: RefCell<SymbolId>,
|
||||
pub symbol_id: Cell<SymbolId>,
|
||||
}
|
||||
|
||||
impl Hash for BindingIdentifier {
|
||||
|
|
|
|||
|
|
@ -85,13 +85,13 @@ impl<'a> Visit<'a> for ManglerBuilder<'a> {
|
|||
) {
|
||||
let symbol_id =
|
||||
self.semantic.declare_symbol_for_mangler(ident.span, &ident.name, includes, excludes);
|
||||
*ident.symbol_id.borrow_mut() = symbol_id;
|
||||
ident.symbol_id.replace(symbol_id);
|
||||
}
|
||||
|
||||
fn visit_identifier_reference(&mut self, ident: &'a IdentifierReference) {
|
||||
let reference = Reference::new(ident.span, ident.name.clone(), ReferenceFlag::read());
|
||||
let reference_id = self.semantic.declare_reference(reference);
|
||||
*ident.reference_id.borrow_mut() = reference_id;
|
||||
ident.reference_id.replace(reference_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue