mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 12:51:57 +00:00
feat(transformer): support generate proper binding name from ChainExpression (#7326)
This commit is contained in:
parent
58db9ef322
commit
6cfb5df9b9
2 changed files with 19 additions and 3 deletions
|
|
@ -186,6 +186,7 @@ impl<'a> GatherNodeParts<'a> for Expression<'a> {
|
||||||
Self::ParenthesizedExpression(expr) => expr.gather(f),
|
Self::ParenthesizedExpression(expr) => expr.gather(f),
|
||||||
Self::UnaryExpression(expr) => expr.gather(f),
|
Self::UnaryExpression(expr) => expr.gather(f),
|
||||||
Self::UpdateExpression(expr) => expr.gather(f),
|
Self::UpdateExpression(expr) => expr.gather(f),
|
||||||
|
Self::ChainExpression(expr) => expr.gather(f),
|
||||||
Self::MetaProperty(expr) => expr.gather(f),
|
Self::MetaProperty(expr) => expr.gather(f),
|
||||||
Self::JSXElement(expr) => expr.gather(f),
|
Self::JSXElement(expr) => expr.gather(f),
|
||||||
Self::JSXFragment(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> {
|
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 {
|
||||||
|
|
|
||||||
|
|
@ -47454,11 +47454,11 @@ rebuilt : ScopeId(0): []
|
||||||
tasks/coverage/typescript/tests/cases/conformance/expressions/nullishCoalescingOperator/nullishCoalescingOperator12.ts
|
tasks/coverage/typescript/tests/cases/conformance/expressions/nullishCoalescingOperator/nullishCoalescingOperator12.ts
|
||||||
semantic error: Bindings mismatch:
|
semantic error: Bindings mismatch:
|
||||||
after transform: ScopeId(0): ["obj"]
|
after transform: ScopeId(0): ["obj"]
|
||||||
rebuilt : ScopeId(0): ["_ref", "obj"]
|
rebuilt : ScopeId(0): ["_obj$arr", "obj"]
|
||||||
Bindings mismatch:
|
Bindings mismatch:
|
||||||
after transform: ScopeId(1): ["_ref", "i"]
|
after transform: ScopeId(1): ["_obj$arr", "i"]
|
||||||
rebuilt : ScopeId(1): ["i"]
|
rebuilt : ScopeId(1): ["i"]
|
||||||
Symbol scope ID mismatch for "_ref":
|
Symbol scope ID mismatch for "_obj$arr":
|
||||||
after transform: SymbolId(2): ScopeId(1)
|
after transform: SymbolId(2): ScopeId(1)
|
||||||
rebuilt : SymbolId(0): ScopeId(0)
|
rebuilt : SymbolId(0): ScopeId(0)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue