Check source function annotations and unify managed function identity

This commit is contained in:
2026-10-21 22:38:22 +08:00
parent eb60212428
commit 6346041f77
27 changed files with 568 additions and 40 deletions
+15
View File
@@ -11,9 +11,23 @@ use crate::{
pub struct Vm {
pub(crate) objects: ObjectStore,
pub(crate) last_traceback: Vec<ExecutionLocation>,
pub(crate) source_type_checks: bool,
}
impl Vm {
pub fn set_source_type_checks(&mut self, enabled: bool) -> Result<(), VmError> {
if self.objects.is_read_only() {
return Err(VmError::UnsupportedOperation(
"configure source type checks during read-only call",
));
}
self.source_type_checks = enabled;
Ok(())
}
pub fn set_function_type(&mut self, definition: ObjectRef) -> Result<(), VmError> {
self.objects.set_function_type(definition)
}
pub fn new_trait(
&mut self,
name: impl Into<String>,
@@ -134,6 +148,7 @@ impl Vm {
Ok(Self {
objects: ObjectStore::new()?,
last_traceback: Vec::new(),
source_type_checks: false,
})
}