Skip to content

Commit

Permalink
refactor(ast): use loop instead of recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Sep 4, 2024
1 parent 59ad46e commit 9652077
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crates/oxc_ast/src/ast_impl/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,11 @@ impl<'a> Expression<'a> {

/// Remove nested parentheses from this expression.
pub fn without_parenthesized(&self) -> &Self {
match self {
Expression::ParenthesizedExpression(expr) => expr.expression.without_parenthesized(),
_ => self,
let mut expr = self;
while let Expression::ParenthesizedExpression(paran_expr) = expr {
expr = &paran_expr.expression;
}
expr
}

pub fn is_specific_id(&self, name: &str) -> bool {
Expand Down

0 comments on commit 9652077

Please sign in to comment.