Skip to content

Commit

Permalink
refactor(semantic): pass Rc by value
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Jun 8, 2024
1 parent b09092c commit 110bb12
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl<'a> SemanticBuilder<'a> {
symbols: SymbolTable::default(),
module_record: Arc::new(ModuleRecord::default()),
label_builder: LabelBuilder::default(),
jsdoc: JSDocBuilder::new(source_text, &trivias),
jsdoc: JSDocBuilder::new(source_text, trivias),
check_syntax_error: false,
cfg: ControlFlowGraphBuilder::default(),
class_table_builder: ClassTableBuilder::new(),
Expand All @@ -109,8 +109,9 @@ impl<'a> SemanticBuilder<'a> {

#[must_use]
pub fn with_trivias(mut self, trivias: Trivias) -> Self {
self.trivias = Rc::new(trivias);
self.jsdoc = JSDocBuilder::new(self.source_text, &self.trivias);
let trivias = Rc::new(trivias);
self.trivias = Rc::clone(&trivias);
self.jsdoc = JSDocBuilder::new(self.source_text, trivias);
self
}

Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_semantic/src/jsdoc/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ pub struct JSDocBuilder<'a> {
}

impl<'a> JSDocBuilder<'a> {
pub fn new(source_text: &'a str, trivias: &Rc<Trivias>) -> Self {
pub fn new(source_text: &'a str, trivias: Rc<Trivias>) -> Self {
Self {
source_text,
trivias: Rc::clone(trivias),
trivias,
attached_docs: BTreeMap::default(),
leading_comments_seen: FxHashSet::default(),
}
Expand Down

0 comments on commit 110bb12

Please sign in to comment.