feat: expose validated class registration to VM hosts

This commit is contained in:
2026-10-21 02:40:18 +08:00
parent 2b5539cd06
commit 44a02c9fd6
4 changed files with 15 additions and 2 deletions
+11
View File
@@ -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>,