mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
refactor(transformer/class-properties): remove a branch from transform_call_expression_impl (#7507)
Small optimization. `transform_call_expression_impl` does not require the `Expression::CallExpression`, only the `CallExpression` itself. So pass that into the function, instead of having to unwrap it (which is an unnecessary branch).
This commit is contained in:
parent
1c4b29c100
commit
5261547c25
1 changed files with 4 additions and 4 deletions
|
|
@ -128,21 +128,21 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
|
||||||
) {
|
) {
|
||||||
let Expression::CallExpression(call_expr) = expr else { unreachable!() };
|
let Expression::CallExpression(call_expr) = expr else { unreachable!() };
|
||||||
if matches!(&call_expr.callee, Expression::PrivateFieldExpression(_)) {
|
if matches!(&call_expr.callee, Expression::PrivateFieldExpression(_)) {
|
||||||
self.transform_call_expression_impl(expr, ctx);
|
self.transform_call_expression_impl(call_expr, ctx);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn transform_call_expression_impl(
|
fn transform_call_expression_impl(
|
||||||
&mut self,
|
&mut self,
|
||||||
expr: &mut Expression<'a>,
|
call_expr: &mut CallExpression<'a>,
|
||||||
ctx: &mut TraverseCtx<'a>,
|
ctx: &mut TraverseCtx<'a>,
|
||||||
) {
|
) {
|
||||||
// Unfortunately no way to make compiler see that these branches are provably unreachable.
|
// Unfortunately no way to make compiler see that this branch is provably unreachable.
|
||||||
// This function is much too large to inline.
|
// This function is much too large to inline.
|
||||||
let Expression::CallExpression(call_expr) = expr else { unreachable!() };
|
|
||||||
let Expression::PrivateFieldExpression(field_expr) = &mut call_expr.callee else {
|
let Expression::PrivateFieldExpression(field_expr) = &mut call_expr.callee else {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
};
|
};
|
||||||
|
|
||||||
let prop_details = self.lookup_private_property(&field_expr.field);
|
let prop_details = self.lookup_private_property(&field_expr.field);
|
||||||
// TODO: Should never be `None` - only because implementation is incomplete.
|
// TODO: Should never be `None` - only because implementation is incomplete.
|
||||||
let Some((prop, class_name_binding, is_declaration)) = prop_details else { return };
|
let Some((prop, class_name_binding, is_declaration)) = prop_details else { return };
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue