chore(fmt): add legacy stubs and strip trailing whitespace to unblock cargo fmt
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user