Skip to content

Commit

Permalink
feat(transformer/class-properties): transform ChainExpression (#7575)
Browse files Browse the repository at this point in the history
Fully support transforming ChainExpression in class properties. Our implementation has some differences in execution order compared to Babel, but we have passed all execution-related tests.
  • Loading branch information
Dunqing committed Dec 4, 2024
1 parent bd9d38a commit c793d71
Show file tree
Hide file tree
Showing 5 changed files with 599 additions and 458 deletions.
8 changes: 7 additions & 1 deletion crates/oxc_transformer/src/es2022/class_properties/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,15 @@ impl<'a, 'ctx> Traverse<'a> for ClassProperties<'a, 'ctx> {
}
// `object?.#prop`
Expression::ChainExpression(_) => {
// TODO: `transform_chain_expression` is no-op at present
self.transform_chain_expression(expr, ctx);
}
// `delete object?.#prop.xyz`
Expression::UnaryExpression(unary)
if unary.operator == UnaryOperator::Delete
&& matches!(unary.argument, Expression::ChainExpression(_)) =>
{
self.transform_unary_expression(expr, ctx);
}
// "object.#prop`xyz`"
Expression::TaggedTemplateExpression(_) => {
// TODO: `transform_tagged_template_expression` is no-op at present
Expand Down
Loading

0 comments on commit c793d71

Please sign in to comment.