diff options
Diffstat (limited to 'tvix/eval/src/compiler')
-rw-r--r-- | tvix/eval/src/compiler/optimiser.rs | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/tvix/eval/src/compiler/optimiser.rs b/tvix/eval/src/compiler/optimiser.rs index ace5335d6835..4c28b79a851e 100644 --- a/tvix/eval/src/compiler/optimiser.rs +++ b/tvix/eval/src/compiler/optimiser.rs @@ -9,7 +9,6 @@ use ast::Expr; pub(super) fn optimise_expr(c: &mut Compiler, slot: LocalIdx, expr: ast::Expr) -> ast::Expr { match expr { Expr::BinOp(_) => optimise_bin_op(c, slot, expr), - Expr::Paren(_) => optimise_paren(c, expr), _ => expr.to_owned(), } } @@ -124,28 +123,3 @@ fn optimise_bin_op(c: &mut Compiler, slot: LocalIdx, expr: ast::Expr) -> ast::Ex expr } - -/// Detect useless parenthesis around primitive expressions. -fn optimise_paren(c: &mut Compiler, expr: ast::Expr) -> ast::Expr { - if let Expr::Paren(inner) = &expr { - let inner = inner.expr().unwrap(); - - if let Expr::Paren(_) = &inner { - c.emit_warning(&expr, WarningKind::UselessParens); - return optimise_paren(c, inner); - } - - if let Expr::Literal(_) - | Expr::Str(_) - | Expr::Select(_) - | Expr::List(_) - | Expr::AttrSet(_) - | Expr::Ident(_) = &inner - { - c.emit_warning(&expr, WarningKind::UselessParens); - return inner; - } - } - - expr -} |