Minor cleanup.

This commit is contained in:
Stephen Chung
2022-12-09 20:42:55 +08:00
parent 30ff208104
commit f15a9a7c9c
9 changed files with 41 additions and 38 deletions

View File

@@ -22,7 +22,7 @@ bitflags! {
/// Is looping allowed?
const LOOPING = 0b_0000_0010_0000;
/// Is variables shadowing allowed?
const SHADOW = 0b_0000_0100_0000;
const SHADOWING = 0b_0000_0100_0000;
/// Strict variables mode?
const STRICT_VAR = 0b_0000_1000_0000;
/// Raise error if an object map property does not exist?
@@ -43,7 +43,7 @@ impl LangOptions {
| Self::SWITCH_EXPR
| Self::STMT_EXPR
| Self::LOOPING
| Self::SHADOW
| Self::SHADOWING
| Self::FAST_OPS
| {
#[cfg(not(feature = "no_function"))]
@@ -148,12 +148,12 @@ impl Engine {
#[inline(always)]
#[must_use]
pub const fn allow_shadowing(&self) -> bool {
self.options.contains(LangOptions::SHADOW)
self.options.contains(LangOptions::SHADOWING)
}
/// Set whether variables shadowing is allowed.
#[inline(always)]
pub fn set_allow_shadowing(&mut self, enable: bool) -> &mut Self {
self.options.set(LangOptions::SHADOW, enable);
self.options.set(LangOptions::SHADOWING, enable);
self
}
/// Is strict variables mode enabled?