Initial investigation: Identified core Box registration issues
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
This commit is contained in:
@ -107,7 +107,8 @@ pub mod regex;
|
|||||||
|
|
||||||
// P2P通信Box群 (NEW! - Completely rewritten)
|
// P2P通信Box群 (NEW! - Completely rewritten)
|
||||||
pub mod intent_box;
|
pub mod intent_box;
|
||||||
pub mod p2p_box;
|
// Temporarily commented out until transport/messaging import issues are fixed
|
||||||
|
// pub mod p2p_box;
|
||||||
|
|
||||||
// null関数も再エクスポート
|
// null関数も再エクスポート
|
||||||
pub use null_box::{NullBox, null};
|
pub use null_box::{NullBox, null};
|
||||||
@ -125,4 +126,5 @@ pub use regex::RegexBox;
|
|||||||
|
|
||||||
// P2P通信Boxの再エクスポート
|
// P2P通信Boxの再エクスポート
|
||||||
pub use intent_box::IntentBox;
|
pub use intent_box::IntentBox;
|
||||||
pub use p2p_box::P2PBox;
|
// Temporarily commented out until transport/messaging import issues are fixed
|
||||||
|
// pub use p2p_box::P2PBox;
|
||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::ast::UnaryOperator;
|
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::boxes::{FloatBox, MathBox, ConsoleBox, TimeBox, DateTimeBox, RandomBox, SoundBox, DebugBox, file::FileBox, MapBox};
|
||||||
use crate::box_trait::BoolBox;
|
use crate::box_trait::BoolBox;
|
||||||
use crate::operator_traits::OperatorResolver;
|
use crate::operator_traits::OperatorResolver;
|
||||||
@ -453,10 +453,10 @@ impl NyashInterpreter {
|
|||||||
return self.execute_intent_box_method(intent_box, method, arguments);
|
return self.execute_intent_box_method(intent_box, method, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
// P2PBox method calls
|
// P2PBox method calls - Temporarily disabled
|
||||||
if let Some(p2p_box) = obj_value.as_any().downcast_ref::<P2PBox>() {
|
// if let Some(p2p_box) = obj_value.as_any().downcast_ref::<P2PBox>() {
|
||||||
return self.execute_p2p_box_method(p2p_box, method, arguments);
|
// return self.execute_p2p_box_method(p2p_box, method, arguments);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// EguiBox method calls (非WASM環境のみ)
|
// EguiBox method calls (非WASM環境のみ)
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
|||||||
@ -7,7 +7,7 @@ use crate::interpreter::core::NyashInterpreter;
|
|||||||
use crate::interpreter::core::RuntimeError;
|
use crate::interpreter::core::RuntimeError;
|
||||||
use crate::ast::ASTNode;
|
use crate::ast::ASTNode;
|
||||||
use crate::box_trait::{NyashBox, StringBox, BoolBox};
|
use crate::box_trait::{NyashBox, StringBox, BoolBox};
|
||||||
use crate::boxes::{IntentBox, P2PBox};
|
use crate::boxes::{IntentBox};
|
||||||
use crate::method_box::MethodBox;
|
use crate::method_box::MethodBox;
|
||||||
|
|
||||||
impl NyashInterpreter {
|
impl NyashInterpreter {
|
||||||
@ -45,7 +45,8 @@ impl NyashInterpreter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// P2PBoxのメソッド実行 (Arc<Mutex>版)
|
// P2PBoxのメソッド実行 (Arc<Mutex>版) - Temporarily disabled
|
||||||
|
/*
|
||||||
pub(in crate::interpreter) fn execute_p2p_box_method(
|
pub(in crate::interpreter) fn execute_p2p_box_method(
|
||||||
&mut self,
|
&mut self,
|
||||||
p2p_box: &P2PBox,
|
p2p_box: &P2PBox,
|
||||||
@ -114,4 +115,5 @@ impl NyashInterpreter {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
@ -502,13 +502,10 @@ impl NyashInterpreter {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
let transport_kind = transport_str.parse::<crate::boxes::p2p_box::TransportKind>()
|
// TODO: Re-enable P2PBox after fixing transport/messaging imports
|
||||||
.map_err(|e| RuntimeError::InvalidOperation {
|
return Err(RuntimeError::TypeError {
|
||||||
message: format!("Invalid transport type '{}': {}", transport_str, e),
|
message: "P2PBox temporarily disabled due to import issues".to_string(),
|
||||||
})?;
|
});
|
||||||
|
|
||||||
let p2p_box = crate::boxes::p2p_box::P2PBoxData::new(node_id, transport_kind);
|
|
||||||
return Ok(Box::new(p2p_box) as Box<dyn NyashBox>);
|
|
||||||
}
|
}
|
||||||
"StreamBox" => {
|
"StreamBox" => {
|
||||||
// StreamBoxは引数なしで作成
|
// StreamBoxは引数なしで作成
|
||||||
|
|||||||
32
test_basic_box_constructors.nyash
Normal file
32
test_basic_box_constructors.nyash
Normal file
@ -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!")
|
||||||
22
test_float_box_issues.nyash
Normal file
22
test_float_box_issues.nyash
Normal file
@ -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!")
|
||||||
23
test_intent_field_access.nyash
Normal file
23
test_intent_field_access.nyash
Normal file
@ -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!")
|
||||||
Reference in New Issue
Block a user