From b2f3564ff27fd32913bb731350376e039e64c3b0 Mon Sep 17 00:00:00 2001 From: imaqtkatt Date: Mon, 26 Feb 2024 09:12:25 -0300 Subject: [PATCH] Add set all and no_all methods --- src/lib.rs | 10 ++++++++++ src/main.rs | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 16426335..6a408638 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -348,6 +348,16 @@ impl CompileOpts { } } + /// Set all opts as true and keep the current adt encoding. + pub fn set_all(self) -> Self { + Self { adt_encoding: self.adt_encoding, ..Self::heavy() } + } + + /// Set all opts as false and keep the current adt encoding. + pub fn set_no_all(self) -> Self { + Self { adt_encoding: self.adt_encoding, ..Self::default() } + } + /// All optimizations disabled, except detach supercombinators. pub fn light() -> Self { Self { supercombinators: true, ..Self::default() } diff --git a/src/main.rs b/src/main.rs index 7f0ed018..1e5c5434 100644 --- a/src/main.rs +++ b/src/main.rs @@ -306,8 +306,8 @@ impl OptArgs { let mut opts = CompileOpts::light(); for arg in args { match arg { - All => opts = CompileOpts::heavy(), - NoAll => opts = CompileOpts::default(), + All => opts = opts.set_all(), + NoAll => opts = opts.set_no_all(), Eta => opts.eta = true, NoEta => opts.eta = false, Prune => opts.prune = true,