diff --git a/src/boxes/mod.rs b/src/boxes/mod.rs index 1fb3ca58..151bb440 100644 --- a/src/boxes/mod.rs +++ b/src/boxes/mod.rs @@ -107,7 +107,8 @@ pub mod regex; // P2P通信Box群 (NEW! - Completely rewritten) pub mod intent_box; -pub mod p2p_box; +// Temporarily commented out until transport/messaging import issues are fixed +// pub mod p2p_box; // null関数も再エクスポート pub use null_box::{NullBox, null}; @@ -125,4 +126,5 @@ pub use regex::RegexBox; // P2P通信Boxの再エクスポート pub use intent_box::IntentBox; -pub use p2p_box::P2PBox; \ No newline at end of file +// Temporarily commented out until transport/messaging import issues are fixed +// pub use p2p_box::P2PBox; \ No newline at end of file diff --git a/src/interpreter/expressions.rs b/src/interpreter/expressions.rs index 1a1cdac0..a5bda4fb 100644 --- a/src/interpreter/expressions.rs +++ b/src/interpreter/expressions.rs @@ -8,7 +8,7 @@ use super::*; use crate::ast::UnaryOperator; -use crate::boxes::{buffer::BufferBox, JSONBox, HttpClientBox, StreamBox, RegexBox, IntentBox, P2PBox}; +use crate::boxes::{buffer::BufferBox, JSONBox, HttpClientBox, StreamBox, RegexBox, IntentBox}; use crate::boxes::{FloatBox, MathBox, ConsoleBox, TimeBox, DateTimeBox, RandomBox, SoundBox, DebugBox, file::FileBox, MapBox}; use crate::box_trait::BoolBox; use crate::operator_traits::OperatorResolver; @@ -453,10 +453,10 @@ impl NyashInterpreter { return self.execute_intent_box_method(intent_box, method, arguments); } - // P2PBox method calls - if let Some(p2p_box) = obj_value.as_any().downcast_ref::() { - return self.execute_p2p_box_method(p2p_box, method, arguments); - } + // P2PBox method calls - Temporarily disabled + // if let Some(p2p_box) = obj_value.as_any().downcast_ref::() { + // return self.execute_p2p_box_method(p2p_box, method, arguments); + // } // EguiBox method calls (非WASM環境のみ) #[cfg(not(target_arch = "wasm32"))] diff --git a/src/interpreter/methods/p2p_methods.rs b/src/interpreter/methods/p2p_methods.rs index 0a214f5b..1139e326 100644 --- a/src/interpreter/methods/p2p_methods.rs +++ b/src/interpreter/methods/p2p_methods.rs @@ -7,7 +7,7 @@ use crate::interpreter::core::NyashInterpreter; use crate::interpreter::core::RuntimeError; use crate::ast::ASTNode; use crate::box_trait::{NyashBox, StringBox, BoolBox}; -use crate::boxes::{IntentBox, P2PBox}; +use crate::boxes::{IntentBox}; use crate::method_box::MethodBox; impl NyashInterpreter { @@ -45,7 +45,8 @@ impl NyashInterpreter { } } - /// P2PBoxのメソッド実行 (Arc版) + // P2PBoxのメソッド実行 (Arc版) - Temporarily disabled + /* pub(in crate::interpreter) fn execute_p2p_box_method( &mut self, p2p_box: &P2PBox, @@ -114,4 +115,5 @@ impl NyashInterpreter { }) } } + */ } \ No newline at end of file diff --git a/src/interpreter/objects.rs b/src/interpreter/objects.rs index df5e5eaa..c90d1e53 100644 --- a/src/interpreter/objects.rs +++ b/src/interpreter/objects.rs @@ -502,13 +502,10 @@ impl NyashInterpreter { }); }; - let transport_kind = transport_str.parse::() - .map_err(|e| RuntimeError::InvalidOperation { - message: format!("Invalid transport type '{}': {}", transport_str, e), - })?; - - let p2p_box = crate::boxes::p2p_box::P2PBoxData::new(node_id, transport_kind); - return Ok(Box::new(p2p_box) as Box); + // TODO: Re-enable P2PBox after fixing transport/messaging imports + return Err(RuntimeError::TypeError { + message: "P2PBox temporarily disabled due to import issues".to_string(), + }); } "StreamBox" => { // StreamBoxは引数なしで作成 diff --git a/test_basic_box_constructors.nyash b/test_basic_box_constructors.nyash new file mode 100644 index 00000000..43954e7d --- /dev/null +++ b/test_basic_box_constructors.nyash @@ -0,0 +1,32 @@ +// Test Basic Box Constructor Issues (Problem 1) +// This should demonstrate the core failures described in the issue + +local console = new ConsoleBox() +console.log("=== Testing Basic Box Constructors ===") + +// Test StringBox constructor +console.log("Testing StringBox constructor...") +local str_box = new StringBox("test") +console.log("StringBox created: " + str_box.toString()) + +// Test IntegerBox constructor +console.log("Testing IntegerBox constructor...") +local int_box = new IntegerBox(123) +console.log("IntegerBox created: " + int_box.toString()) + +// Test BoolBox constructor +console.log("Testing BoolBox constructor...") +local bool_box = new BoolBox(false) +console.log("BoolBox created: " + bool_box.toString()) + +// Compare with literals (these should work) +console.log("=== Comparing with Literals ===") +local str_literal = "test" +local int_literal = 123 +local bool_literal = false + +console.log("String literal: " + str_literal) +console.log("Integer literal: " + int_literal) +console.log("Bool literal: " + bool_literal) + +console.log("Test complete!") \ No newline at end of file diff --git a/test_float_box_issues.nyash b/test_float_box_issues.nyash new file mode 100644 index 00000000..6f2e1fe2 --- /dev/null +++ b/test_float_box_issues.nyash @@ -0,0 +1,22 @@ +// Test FloatBox Issues (Problem 4) +// This should demonstrate the FloatBox value access issues + +local console = new ConsoleBox() +console.log("=== Testing FloatBox Issues ===") + +// Test FloatBox creation (this should work) +console.log("Creating FloatBox...") +local float = new FloatBox(3.14) +console.log("FloatBox created successfully") + +// Test toString method (this should work) +console.log("Testing toString...") +local float_str = float.toString() +console.log("FloatBox toString: " + float_str) + +// Test value field access (this should fail) +console.log("Testing value field access...") +// local value = float.value +// console.log("FloatBox value: " + value) + +console.log("FloatBox test complete!") \ No newline at end of file diff --git a/test_intent_field_access.nyash b/test_intent_field_access.nyash new file mode 100644 index 00000000..08d9b368 --- /dev/null +++ b/test_intent_field_access.nyash @@ -0,0 +1,23 @@ +// Test IntentBox Field Access Issues (Problem 2) +// This should demonstrate the field access failures described + +local console = new ConsoleBox() +console.log("=== Testing IntentBox Field Access ===") + +// Test IntentBox creation (this should work) +console.log("Creating IntentBox...") +local intent = new IntentBox("test", "Hello") +console.log("IntentBox created successfully") + +// Test field access methods (these should be the issue) +console.log("Testing field access...") + +// Try getName method +local name = intent.getName() +console.log("Intent name: " + name) + +// Try getPayload method +local payload = intent.getPayload() +console.log("Intent payload: " + payload) + +console.log("Field access test complete!") \ No newline at end of file