diff --git a/crates/oxc_traverse/src/ast_operations/gather_node_parts.rs b/crates/oxc_traverse/src/ast_operations/gather_node_parts.rs index aa4ef25cf7aa8..3c0d730561f81 100644 --- a/crates/oxc_traverse/src/ast_operations/gather_node_parts.rs +++ b/crates/oxc_traverse/src/ast_operations/gather_node_parts.rs @@ -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), @@ -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 { diff --git a/tasks/coverage/snapshots/semantic_typescript.snap b/tasks/coverage/snapshots/semantic_typescript.snap index 424fec9b49530..6a630dc206491 100644 --- a/tasks/coverage/snapshots/semantic_typescript.snap +++ b/tasks/coverage/snapshots/semantic_typescript.snap @@ -47454,11 +47454,11 @@ rebuilt : ScopeId(0): [] tasks/coverage/typescript/tests/cases/conformance/expressions/nullishCoalescingOperator/nullishCoalescingOperator12.ts semantic error: Bindings mismatch: after transform: ScopeId(0): ["obj"] -rebuilt : ScopeId(0): ["_ref", "obj"] +rebuilt : ScopeId(0): ["_obj$arr", "obj"] Bindings mismatch: -after transform: ScopeId(1): ["_ref", "i"] +after transform: ScopeId(1): ["_obj$arr", "i"] rebuilt : ScopeId(1): ["i"] -Symbol scope ID mismatch for "_ref": +Symbol scope ID mismatch for "_obj$arr": after transform: SymbolId(2): ScopeId(1) rebuilt : SymbolId(0): ScopeId(0)