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:
+2
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user