Add set all and no_all methods

This commit is contained in:
imaqtkatt 2024-02-26 09:12:25 -03:00
parent e7056da312
commit b2f3564ff2
2 changed files with 12 additions and 2 deletions

View File

@ -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() }

View File

@ -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,