From 735c0d3bd64ea365587ded241230268e6740c84e Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Thu, 3 Jul 2025 13:05:57 +0000 Subject: [PATCH] perf(ast): call `Expression::without_parentheses` only once (#12056) Follow-on after #12038. Call `Expression::without_parentheses` once, instead of twice. --- crates/oxc_ast/src/ast_impl/js.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/oxc_ast/src/ast_impl/js.rs b/crates/oxc_ast/src/ast_impl/js.rs index d45871558e405..7927e5016561c 100644 --- a/crates/oxc_ast/src/ast_impl/js.rs +++ b/crates/oxc_ast/src/ast_impl/js.rs @@ -373,10 +373,11 @@ impl<'a> Expression<'a> { /// Is identifier or `a.b` expression where `a` is an identifier. pub fn is_entity_name_expression(&self) -> bool { - matches!(self.without_parentheses(), Expression::Identifier(_)) - // Special case: treat `this.B` like `this` was an identifier - || matches!(self.without_parentheses(), Expression::ThisExpression(_)) - || self.is_property_access_entity_name_expression() + // Special case: treat `this.B` like `this` was an identifier + matches!( + self.without_parentheses(), + Expression::Identifier(_) | Expression::ThisExpression(_) + ) || self.is_property_access_entity_name_expression() } /// `a.b` expression where `a` is an identifier.