mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
refactor(ast): use loop instead of recursion (#5447)
Use loop instead of recursive function call. Loops are usually cheaper.
This commit is contained in:
parent
6285a02274
commit
a43e9512f3
1 changed files with 4 additions and 3 deletions
|
|
@ -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 = ¶n_expr.expression;
|
||||
}
|
||||
expr
|
||||
}
|
||||
|
||||
pub fn is_specific_id(&self, name: &str) -> bool {
|
||||
|
|
|
|||
Loading…
Reference in a new issue