chore(fmt): add legacy stubs and strip trailing whitespace to unblock cargo fmt

This commit is contained in:
Selfhosting Dev
2025-09-17 07:43:07 +09:00
parent fcf8ce1f3c
commit adbb0201a9
385 changed files with 35622 additions and 15004 deletions

View File

@ -1,14 +1,14 @@
/*!
* User-Defined Box Factory
*
*
* Handles creation of user-defined Box types through InstanceBox
* Manages inheritance, fields, methods, and birth/fini lifecycle
*/
use super::BoxFactory;
use crate::box_trait::NyashBox;
use crate::interpreter::{RuntimeError, SharedState};
use crate::instance_v2::InstanceBox;
use crate::interpreter::{RuntimeError, SharedState};
/// Factory for user-defined Box types
pub struct UserDefinedBoxFactory {
@ -17,9 +17,7 @@ pub struct UserDefinedBoxFactory {
impl UserDefinedBoxFactory {
pub fn new(shared_state: SharedState) -> Self {
Self {
shared_state,
}
Self { shared_state }
}
}
@ -34,31 +32,31 @@ impl BoxFactory for UserDefinedBoxFactory {
let box_decls = self.shared_state.box_declarations.read().unwrap();
box_decls.get(name).cloned()
};
let box_decl = box_decl.ok_or_else(|| RuntimeError::InvalidOperation {
message: format!("Unknown Box type: {}", name),
})?;
// Create InstanceBox with fields and methods
let instance = InstanceBox::from_declaration(
name.to_string(),
box_decl.fields.clone(),
box_decl.methods.clone(),
);
// TODO: Execute birth/init constructor with args
// For now, just return the instance
Ok(Box::new(instance))
}
fn box_types(&self) -> Vec<&str> {
// Can't return borrowed strings from temporary RwLock guard
// For now, return empty - this method isn't critical
vec![]
}
fn is_available(&self) -> bool {
// Always available when SharedState is present
true
}
}
}