Skip to content

Commit 27f587c

Browse files
leaysgurcamc314
andcommitted
Apply suggestion from @camc314
Co-authored-by: Cameron <cameron.clark@hey.com> Signed-off-by: Yuji Sugiura <6259812+leaysgur@users.noreply.github.com>
1 parent 2dd851e commit 27f587c

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

crates/oxc_traverse/src/ast_operations/gather_node_parts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ impl<'a> GatherNodeParts<'a> for ChainElement<'a> {
235235
match self {
236236
ChainElement::CallExpression(expr) => expr.gather(f),
237237
ChainElement::TSNonNullExpression(expr) => expr.expression.gather(f),
238-
expr => expr.to_member_expression().gather(f),
238+
expr @ match_member_expression!(Self) => expr.to_member_expression().gather(f),
239239
}
240240
}
241241
}

tasks/transform_conformance/snapshots/oxc.snap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
commit: 6402dbbf
22

3-
Passed: 229/377
3+
Passed: 230/378
44

55
# All Passed:
66
* babel-plugin-transform-class-static-block
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Panicked when transforming optional chaining with TS non-null assertion inside a computed key.
2+
// https://github.com/oxc-project/oxc/issues/22246
3+
const x = a[b?.c!]?.["d"];
4+
const y = a?.[b?.c!]?.d;
5+
const z = a[b?.c!.d!]?.e;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Panicked when transforming optional chaining with TS non-null assertion inside a computed key.
2+
// https://github.com/oxc-project/oxc/issues/22246
3+
var _a$b$c, _b, _a, _b2, _a$d, _b3;
4+
const x = (_a$b$c = a[(_b = b) === null || _b === void 0 ? void 0 : _b.c]) === null || _a$b$c === void 0 ? void 0 : _a$b$c["d"];
5+
const y = (_a = a) === null || _a === void 0 || (_a = _a[(_b2 = b) === null || _b2 === void 0 ? void 0 : _b2.c]) === null || _a === void 0 ? void 0 : _a.d;
6+
const z = (_a$d = a[(_b3 = b) === null || _b3 === void 0 ? void 0 : _b3.c.d]) === null || _a$d === void 0 ? void 0 : _a$d.e;

0 commit comments

Comments
 (0)