Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(semantic)!: Reference::flag method return ReferenceFlag #5019

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
2 changes: 1 addition & 1 deletion crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ impl<'a> SemanticBuilder<'a> {

references.retain(|&reference_id| {
let reference = &mut self.symbols.references[reference_id];
let flag = *reference.flag();
let flag = reference.flag();
if flag.is_type() && symbol_flag.can_be_referenced_by_type()
|| flag.is_value() && symbol_flag.can_be_referenced_by_value()
|| flag.is_ts_type_query() && symbol_flag.is_import()
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_semantic/src/reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ impl Reference {
}

#[inline]
pub fn flag(&self) -> &ReferenceFlag {
&self.flag
pub fn flag(&self) -> ReferenceFlag {
self.flag
}

#[inline]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl<'a> ExponentiationOperator<'a> {
let reference = ctx.symbols().get_reference(ident.reference_id.get().unwrap());
let symbol_id = reference.symbol_id();
let flag = reference.flag();
ctx.create_reference_id(ident.span, ident.name.clone(), symbol_id, *flag)
ctx.create_reference_id(ident.span, ident.name.clone(), symbol_id, flag)
}

fn clone_expression(expr: &Expression<'a>, ctx: &mut TraverseCtx<'a>) -> Expression<'a> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl<'a> LogicalAssignmentOperators<'a> {
let reference = ctx.symbols().get_reference(ident.reference_id.get().unwrap());
let symbol_id = reference.symbol_id();
let flag = reference.flag();
ctx.create_reference_id(ident.span, ident.name.clone(), symbol_id, *flag)
ctx.create_reference_id(ident.span, ident.name.clone(), symbol_id, flag)
}

pub fn maybe_generate_memoised(
Expand Down