Skip to content

Commit

Permalink
refactor(transformer): use into_member_expression (#5006)
Browse files Browse the repository at this point in the history
Use new `into_member_expression` API introduced in #5005 in TS transforms.
  • Loading branch information
overlookmotel committed Aug 20, 2024
1 parent 714373d commit 8d15e65
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions crates/oxc_transformer/src/typescript/annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,7 @@ impl<'a> TypeScriptAnnotations<'a> {
// `foo.bar!++` to `foo.bar++`
inner_expr @ match_member_expression!(Expression) => {
let inner_expr = self.ctx.ast.move_expression(inner_expr);
let Ok(member_expr) = MemberExpression::try_from(inner_expr) else {
unreachable!();
};
let member_expr = inner_expr.into_member_expression();
*target = SimpleAssignmentTarget::from(member_expr);
}
_ => {
Expand All @@ -254,9 +252,7 @@ impl<'a> TypeScriptAnnotations<'a> {
let inner_expr = expr.get_inner_expression_mut();
if inner_expr.is_member_expression() {
let inner_expr = self.ctx.ast.move_expression(inner_expr);
let Ok(member_expr) = MemberExpression::try_from(inner_expr) else {
unreachable!();
};
let member_expr = inner_expr.into_member_expression();
*target = AssignmentTarget::from(member_expr);
}
}
Expand Down

0 comments on commit 8d15e65

Please sign in to comment.