Make limit getters available without unchecked.

This commit is contained in:
Stephen Chung
2022-10-04 15:33:51 +08:00
parent e8fd965eba
commit 891214470b
11 changed files with 87 additions and 37 deletions

View File

@@ -36,6 +36,7 @@ pub struct GlobalRuntimeState<'a> {
/// Number of operations performed.
pub num_operations: u64,
/// Number of modules loaded.
#[cfg(not(feature = "no_module"))]
pub num_modules_loaded: usize,
/// Level of the current scope.
///

View File

@@ -738,7 +738,7 @@ impl Engine {
#[cfg(feature = "no_object")]
_ => {
err.take_position();
let _ = err.take_position();
err.to_string().into()
}
#[cfg(not(feature = "no_object"))]
@@ -924,7 +924,6 @@ impl Engine {
let (expr, export) = &**x;
// Guard against too many modules
#[cfg(not(feature = "unchecked"))]
if global.num_modules_loaded >= self.max_modules() {
return Err(ERR::ErrorTooManyModules(*_pos).into());
}