revert: 古いプラグインシステム実装前の状態に巻き戻し
- ソースコードをcommit 3f7d71fの状態に復元(古いプラグインシステム実装前) - docsフォルダは最新の状態を維持(BID-FFI設計ドキュメント含む) - nyashバイナリの基本動作確認済み - BID-FFIシステムをクリーンに再実装する準備完了 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -10,64 +10,11 @@
|
||||
use super::super::*;
|
||||
use crate::box_trait::{ResultBox, StringBox, NyashBox};
|
||||
use crate::boxes::FileBox;
|
||||
#[cfg(feature = "dynamic-file")]
|
||||
use crate::interpreter::plugin_loader::FileBoxProxy;
|
||||
|
||||
impl NyashInterpreter {
|
||||
/// FileBoxのメソッド呼び出しを実行
|
||||
/// Handles file I/O operations including read, write, exists, delete, and copy
|
||||
pub(in crate::interpreter) fn execute_file_method(&mut self, file_box: &FileBox, method: &str, arguments: &[ASTNode])
|
||||
-> Result<Box<dyn NyashBox>, RuntimeError> {
|
||||
self.execute_file_method_static(file_box, method, arguments)
|
||||
}
|
||||
|
||||
/// FileBoxProxyのメソッド呼び出しを実行(動的ライブラリ版)
|
||||
#[cfg(feature = "dynamic-file")]
|
||||
pub(in crate::interpreter) fn execute_file_proxy_method(&mut self, file_box: &FileBoxProxy, method: &str, arguments: &[ASTNode])
|
||||
-> Result<Box<dyn NyashBox>, RuntimeError> {
|
||||
eprintln!("🔍 DEBUG: execute_file_proxy_method called with method: '{}'", method);
|
||||
match method {
|
||||
"read" => {
|
||||
if !arguments.is_empty() {
|
||||
return Err(RuntimeError::InvalidOperation {
|
||||
message: format!("read() expects 0 arguments, got {}", arguments.len()),
|
||||
});
|
||||
}
|
||||
file_box.read()
|
||||
}
|
||||
"write" => {
|
||||
if arguments.len() != 1 {
|
||||
return Err(RuntimeError::InvalidOperation {
|
||||
message: format!("write() expects 1 argument, got {}", arguments.len()),
|
||||
});
|
||||
}
|
||||
let content = self.execute_expression(&arguments[0])?;
|
||||
file_box.write(content)
|
||||
}
|
||||
"exists" => {
|
||||
if !arguments.is_empty() {
|
||||
return Err(RuntimeError::InvalidOperation {
|
||||
message: format!("exists() expects 0 arguments, got {}", arguments.len()),
|
||||
});
|
||||
}
|
||||
file_box.exists()
|
||||
}
|
||||
"toString" => {
|
||||
if !arguments.is_empty() {
|
||||
return Err(RuntimeError::InvalidOperation {
|
||||
message: format!("toString() expects 0 arguments, got {}", arguments.len()),
|
||||
});
|
||||
}
|
||||
Ok(Box::new(file_box.to_string_box()))
|
||||
}
|
||||
_ => Err(RuntimeError::InvalidOperation {
|
||||
message: format!("Undefined method '{}' for FileBox", method),
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
/// 静的FileBoxのメソッド実装
|
||||
fn execute_file_method_static(&mut self, file_box: &FileBox, method: &str, arguments: &[ASTNode])
|
||||
-> Result<Box<dyn NyashBox>, RuntimeError> {
|
||||
match method {
|
||||
"read" => {
|
||||
@ -118,14 +65,6 @@ impl NyashInterpreter {
|
||||
})
|
||||
}
|
||||
}
|
||||
"toString" => {
|
||||
if !arguments.is_empty() {
|
||||
return Err(RuntimeError::InvalidOperation {
|
||||
message: format!("toString() expects 0 arguments, got {}", arguments.len()),
|
||||
});
|
||||
}
|
||||
Ok(Box::new(file_box.to_string_box()))
|
||||
}
|
||||
_ => Err(RuntimeError::InvalidOperation {
|
||||
message: format!("Unknown method '{}' for FileBox", method),
|
||||
})
|
||||
|
||||
@ -23,6 +23,5 @@ pub mod data_methods; // BufferBox, JSONBox, RegexBox
|
||||
pub mod network_methods; // HttpClientBox, StreamBox
|
||||
pub mod p2p_methods; // IntentBox, P2PBox
|
||||
pub mod http_methods; // SocketBox, HTTPServerBox, HTTPRequestBox, HTTPResponseBox
|
||||
pub mod math_methods; // MathBox, RandomBox, TimeBox, DateTimeBox
|
||||
|
||||
// Re-export methods for easy access
|
||||
|
||||
Reference in New Issue
Block a user