feat: Phase 9.78e complete - instance_v2 migration with legacy compatibility

- instance_v2 now includes legacy compatibility layer
- All interpreter code migrated to use instance_v2
- Added legacy field access methods (get_fields, set_field_legacy, etc.)
- Fixed type conversion issues (NyashValue vs SharedNyashBox)
- instance.rs still exists but no longer used in interpreter
- TODO: Remove instance.rs completely in next phase
- TODO: Implement proper SharedNyashBox -> NyashValue conversion

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-19 22:35:34 +09:00
parent 3ae4ae8211
commit 5582ad45c0
36 changed files with 1347926 additions and 43 deletions

View File

@ -104,7 +104,7 @@ use std::sync::RwLock;
use chrono::Local;
use crate::box_trait::{BoxCore, BoxBase, NyashBox, StringBox, BoolBox, VoidBox};
use crate::interpreter::RuntimeError;
use crate::instance::InstanceBox;
use crate::instance_v2::InstanceBox;
use std::any::Any;
#[derive(Debug)]
@ -179,8 +179,10 @@ impl DebugBox {
fn get_box_fields(&self, box_value: &dyn NyashBox) -> String {
// Try to downcast to InstanceBox to get fields
if let Some(instance) = box_value.as_any().downcast_ref::<InstanceBox>() {
let fields = instance.fields.lock().unwrap();
let field_names: Vec<String> = fields.keys().cloned().collect();
// instance_v2では get_fields()メソッドを使用
let fields = instance.get_fields();
let fields_locked = fields.lock().unwrap();
let field_names: Vec<String> = fields_locked.keys().cloned().collect();
field_names.join(", ")
} else {
"N/A".to_string()