Fix call stack limits.

This commit is contained in:
Stephen Chung
2020-12-29 12:29:45 +08:00
parent 41c6f985f5
commit 13f5cec291
8 changed files with 70 additions and 55 deletions

View File

@@ -38,6 +38,7 @@ impl Engine {
/// Set the maximum levels of function calls allowed for a script in order to avoid
/// infinite recursion and stack overflows.
#[cfg(not(feature = "unchecked"))]
#[cfg(not(feature = "no_function"))]
#[inline(always)]
pub fn set_max_call_levels(&mut self, levels: usize) -> &mut Self {
self.limits.max_call_stack_depth = levels;
@@ -45,6 +46,7 @@ impl Engine {
}
/// The maximum levels of function calls allowed for a script.
#[cfg(not(feature = "unchecked"))]
#[cfg(not(feature = "no_function"))]
#[inline(always)]
pub fn max_call_levels(&self) -> usize {
self.limits.max_call_stack_depth