feat(traverse): implement GatherNodeParts for member expression types (#7363)

`GatherNodeParts` was missing support for these types as entry points for collection.
This commit is contained in:
overlookmotel 2024-11-20 03:58:48 +00:00
parent c587dd3cd6
commit 234c7b9fef

View file

@ -218,21 +218,39 @@ impl<'a> GatherNodeParts<'a> for MemberExpression<'a> {
fn gather<F: FnMut(&str)>(&self, f: &mut F) { fn gather<F: FnMut(&str)>(&self, f: &mut F) {
match self { match self {
MemberExpression::ComputedMemberExpression(expr) => { MemberExpression::ComputedMemberExpression(expr) => {
expr.object.gather(f); expr.gather(f);
expr.expression.gather(f);
} }
MemberExpression::StaticMemberExpression(expr) => { MemberExpression::StaticMemberExpression(expr) => {
expr.object.gather(f); expr.gather(f);
expr.property.gather(f);
} }
MemberExpression::PrivateFieldExpression(expr) => { MemberExpression::PrivateFieldExpression(expr) => {
expr.object.gather(f); expr.gather(f);
expr.field.gather(f);
} }
} }
} }
} }
impl<'a> GatherNodeParts<'a> for ComputedMemberExpression<'a> {
fn gather<F: FnMut(&str)>(&self, f: &mut F) {
self.object.gather(f);
self.expression.gather(f);
}
}
impl<'a> GatherNodeParts<'a> for StaticMemberExpression<'a> {
fn gather<F: FnMut(&str)>(&self, f: &mut F) {
self.object.gather(f);
self.property.gather(f);
}
}
impl<'a> GatherNodeParts<'a> for PrivateFieldExpression<'a> {
fn gather<F: FnMut(&str)>(&self, f: &mut F) {
self.object.gather(f);
self.field.gather(f);
}
}
impl<'a> GatherNodeParts<'a> for CallExpression<'a> { impl<'a> GatherNodeParts<'a> for CallExpression<'a> {
fn gather<F: FnMut(&str)>(&self, f: &mut F) { fn gather<F: FnMut(&str)>(&self, f: &mut F) {
self.callee.gather(f); self.callee.gather(f);