Check source function annotations and unify managed function identity
This commit is contained in:
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user