feat: expose validated class registration to VM hosts
This commit is contained in:
@@ -33,6 +33,17 @@ impl Vm {
|
||||
self.objects.bootstrap_types()
|
||||
}
|
||||
|
||||
/// Host registration uses the same validated class builder as source code.
|
||||
pub fn new_class(
|
||||
&mut self,
|
||||
name: impl Into<String>,
|
||||
base: ObjectRef,
|
||||
fields: Vec<crate::ClassField>,
|
||||
methods: std::collections::BTreeMap<String, ObjectRef>,
|
||||
) -> Result<ObjectRef, VmError> {
|
||||
self.objects.new_class(name, base, fields, methods)
|
||||
}
|
||||
|
||||
pub fn new_type(
|
||||
&mut self,
|
||||
name: impl Into<String>,
|
||||
|
||||
Reference in New Issue
Block a user