Refactor: Replace optimization level with boolean flag

The optimizer now uses a simple boolean flag (`optimization`) instead of
an `optimization_level` (u32). This simplifies the optimizer's logic and
makes it easier to enable or disable optimizations.

The command-line interface and internal testing have been updated to
reflect this change.
This commit is contained in:
Michael Schimmel
2026-02-22 01:50:14 +01:00
parent d3cdafbb85
commit 7c997ca841
7 changed files with 52 additions and 49 deletions
+2 -2
View File
@@ -95,7 +95,7 @@ impl CompilerApp {
// Reset environment for a fresh run
self.env = Environment::new();
self.env.optimization_level = 2;
self.env.optimization = true;
let res = (|| -> Result<(myc::ast::types::Value, std::time::Duration), String> {
let start_run = std::time::Instant::now();
@@ -157,7 +157,7 @@ impl CompilerApp {
fn dump_ast(&mut self) {
self.env = Environment::new();
self.env.optimization_level = 2; // Enable optimization for AST dump
self.env.optimization = true; // Enable optimization for AST dump
match self.env.dump_ast(&self.source_code) {
Ok(dump) => {
self.output_log = format!("--- BOUND AST DUMP ---\n\n{}", dump);