refactor: Gemini/ChatGPT collaborative refactoring + build fixes

Major changes:
- Split runner module: 1358→580 lines (via Gemini)
- Create new modules: dispatch.rs, selfhost.rs, pipeline.rs, pipe_io.rs
- Fix build errors from incomplete method migrations
- Add warning to CLAUDE.md about JIT/Cranelift not working
- Create interpreter.rs mode module
- Refactor loop builder into separate module

Build status:
-  Executable builds successfully
-  Basic execution works (tested with print)
- ⚠️ 106 warnings remain (to be cleaned up next)
- ⚠️ execute_mir_mode still in mod.rs (needs further migration)

Note: ChatGPT correctly fixed runner.execute_mir_mode() calls
that I incorrectly changed to super::modes::mir::

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Selfhosting Dev
2025-09-16 03:54:44 +09:00
parent f9bd13f4e4
commit 40db299bab
22 changed files with 425 additions and 613 deletions

View File

@ -31,6 +31,7 @@ pub(crate) fn debug_log(msg: &str) {
}
// Conditional debug macro - unified with utils::debug_on()
#[allow(unused_macros)]
macro_rules! debug_trace {
($($arg:tt)*) => {
if crate::interpreter::utils::debug_on() { eprintln!($($arg)*); }

View File

@ -1,7 +1,7 @@
//! Evaluation entry points: execute program and nodes
use crate::ast::ASTNode;
use crate::box_trait::{NyashBox, VoidBox, StringBox};
use crate::box_trait::{NyashBox, VoidBox};
use super::{NyashInterpreter, RuntimeError, ControlFlow};
impl NyashInterpreter {

View File

@ -22,7 +22,7 @@ use std::sync::Arc;
impl NyashInterpreter {
/// Build closure environment by capturing 'me' and free variables by value (P1)
fn build_closure_env(&mut self, params: &Vec<String>, body: &Vec<ASTNode>) -> Result<crate::boxes::function_box::ClosureEnv, RuntimeError> {
use std::collections::{HashSet, VecDeque};
use std::collections::HashSet;
let mut env = crate::boxes::function_box::ClosureEnv::new();
// Capture 'me' if bound
if let Ok(mev) = self.resolve_variable("me") { env.me_value = Some(Arc::downgrade(&mev)); }

View File

@ -8,7 +8,6 @@ use crate::interpreter::RuntimeError;
use crate::ast::ASTNode;
use crate::box_trait::{NyashBox, StringBox};
use crate::boxes::{IntentBox, P2PBox};
use crate::box_trait::BoolBox;
impl NyashInterpreter {
/// IntentBoxのメソッド実行 (RwLock版)

View File

@ -7,7 +7,7 @@
*/
use crate::ast::ASTNode;
use crate::box_trait::{NyashBox, VoidBox, StringBox, BoolBox};
use crate::box_trait::{NyashBox, BoolBox};
use crate::boxes::gc_config_box::GcConfigBox;
use crate::boxes::debug_config_box::DebugConfigBox;
use crate::interpreter::{NyashInterpreter, RuntimeError};
@ -168,4 +168,4 @@ impl NyashInterpreter {
}),
}
}
}
}

View File

@ -19,7 +19,6 @@ use crate::boxes::debug_box::DebugBox;
// WASM-specific Box types (conditionally included)
#[cfg(target_arch = "wasm32")]
use crate::boxes::web::{WebDisplayBox, WebConsoleBox, WebCanvasBox};
use crate::finalization;
use crate::exception_box;
use std::collections::HashMap;