Skip to content

Commit

Permalink
chore(ast): remove get_object_identifier and get_object_identifier_mut
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing authored and overlookmotel committed Sep 2, 2024
1 parent 94ff94c commit e7cbc77
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions crates/oxc_ast/src/ast_impl/jsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,42 +35,6 @@ impl<'a> JSXElementName<'a> {
}
}

impl<'a> JSXMemberExpression<'a> {
pub fn get_object_identifier(&self) -> &JSXIdentifier<'a> {
let mut member_expr = self;
loop {
match &member_expr.object {
JSXMemberExpressionObject::Identifier(ident) => {
break ident;
}
JSXMemberExpressionObject::IdentifierReference(_) => {
unreachable!()
}
JSXMemberExpressionObject::MemberExpression(expr) => {
member_expr = expr;
}
}
}
}

pub fn get_object_identifier_mut(&mut self) -> &mut JSXIdentifier<'a> {
let mut member_expr = self;
loop {
match &mut member_expr.object {
JSXMemberExpressionObject::Identifier(ident) => {
break &mut *ident;
}
JSXMemberExpressionObject::IdentifierReference(_) => {
unreachable!()
}
JSXMemberExpressionObject::MemberExpression(expr) => {
member_expr = expr;
}
}
}
}
}

impl<'a> fmt::Display for JSXMemberExpression<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}.{}", self.object, self.property)
Expand Down

0 comments on commit e7cbc77

Please sign in to comment.