Phase 20.34: expand MirBuilder internal library with comprehensive lowering boxes; add pattern registry and program scanning infrastructure; implement internal lowerers for if/loop/return patterns; add dev tools and comprehensive canary tests; update VM boxes and host providers for internal delegation; wire phase2034 test suite with 30+ canary scripts covering internal lowering scenarios

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
nyash-codex
2025-11-03 16:09:19 +09:00
parent 8827b8d416
commit a4f30ae827
89 changed files with 4125 additions and 115 deletions

View File

@ -258,7 +258,22 @@ impl NyashRunner {
}
}
match vm.execute_module(&module_vm) {
Ok(_ret) => { /* interpreter already prints via println/console in program */ }
Ok(ret) => {
use crate::box_trait::{NyashBox, IntegerBox, BoolBox};
// Extract exit code from return value
let exit_code = if let Some(ib) = ret.as_any().downcast_ref::<IntegerBox>() {
ib.value as i32
} else if let Some(bb) = ret.as_any().downcast_ref::<BoolBox>() {
if bb.value { 1 } else { 0 }
} else {
// For non-integer/bool returns, default to 0 (success)
0
};
// Exit with the return value as exit code
process::exit(exit_code);
}
Err(e) => {
eprintln!("❌ VM fallback error: {}", e);
process::exit(1);