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(transformer): use identifier_reference_with_reference_id builder method #7056

Merged
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
18 changes: 12 additions & 6 deletions crates/oxc_transformer/src/jsx/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,26 @@ impl<'a> RefreshIdentifierResolver<'a> {
pub fn to_expression(&self, ctx: &mut TraverseCtx<'a>) -> Expression<'a> {
match self {
Self::Identifier(ident) => {
let ident = ident.clone();
let reference_id =
ctx.create_unbound_reference(ident.name.to_compact_str(), ReferenceFlags::Read);
ident.reference_id.set(Some(reference_id));
ctx.ast.expression_from_identifier_reference(ident)
Expression::Identifier(ctx.ast.alloc_identifier_reference_with_reference_id(
ident.span,
ident.name.clone(),
reference_id,
))
}
Self::Member((ident, property)) => {
let ident = ident.clone();
let reference_id =
ctx.create_unbound_reference(ident.name.to_compact_str(), ReferenceFlags::Read);
ident.reference_id.set(Some(reference_id));
let ident =
Expression::Identifier(ctx.ast.alloc_identifier_reference_with_reference_id(
ident.span,
ident.name.clone(),
reference_id,
));
Expression::from(ctx.ast.member_expression_static(
SPAN,
ctx.ast.expression_from_identifier_reference(ident),
ident,
property.clone(),
false,
))
Expand Down
Loading