Skip to content

Commit

Permalink
feat(transformer): support generate proper binding name from ChainExp…
Browse files Browse the repository at this point in the history
…ression
  • Loading branch information
Dunqing committed Nov 19, 2024
1 parent 00d7921 commit f1ee475
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions crates/oxc_traverse/src/ast_operations/gather_node_parts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ impl<'a> GatherNodeParts<'a> for Expression<'a> {
Self::ParenthesizedExpression(expr) => expr.gather(f),
Self::UnaryExpression(expr) => expr.gather(f),
Self::UpdateExpression(expr) => expr.gather(f),
Self::ChainExpression(expr) => expr.gather(f),
Self::MetaProperty(expr) => expr.gather(f),
Self::JSXElement(expr) => expr.gather(f),
Self::JSXFragment(expr) => expr.gather(f),
Expand All @@ -198,6 +199,21 @@ impl<'a> GatherNodeParts<'a> for Expression<'a> {
}
}

impl<'a> GatherNodeParts<'a> for ChainExpression<'a> {
fn gather<F: FnMut(&str)>(&self, f: &mut F) {
self.expression.gather(f);
}
}

impl<'a> GatherNodeParts<'a> for ChainElement<'a> {
fn gather<F: FnMut(&str)>(&self, f: &mut F) {
match self {
ChainElement::CallExpression(expr) => expr.gather(f),
expr => expr.to_member_expression().gather(f),
}
}
}

impl<'a> GatherNodeParts<'a> for MemberExpression<'a> {
fn gather<F: FnMut(&str)>(&self, f: &mut F) {
match self {
Expand Down

0 comments on commit f1ee475

Please sign in to comment.