From 9063549f2e958732036e477ae9f0d79e0b0c7b56 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Sat, 17 Aug 2024 14:56:18 +0200 Subject: [PATCH] Re-use expr formatter for constants. --- crates/aiken-lang/src/format.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/crates/aiken-lang/src/format.rs b/crates/aiken-lang/src/format.rs index 040fac29..7530e10a 100644 --- a/crates/aiken-lang/src/format.rs +++ b/crates/aiken-lang/src/format.rs @@ -295,7 +295,7 @@ impl<'comments> Formatter<'comments> { head.append(" =") .append(break_("", " ")) - .append(self.const_expr(value)) + .append(self.expr(value, true)) .nest(INDENT) .group() } @@ -338,12 +338,6 @@ impl<'comments> Formatter<'comments> { }) } - fn const_expr<'a>(&mut self, _value: &'a UntypedExpr) -> Document<'a> { - todo!( - "format const_expr: surround complex expressions with a block, and leave simple expression without" - ); - } - pub fn docs_const_expr<'a>(&mut self, name: &'a str, value: &'a TypedExpr) -> Document<'a> { let mut printer = tipo::pretty::Printer::new(); name.to_doc()