Use bitflags.
This commit is contained in:
@@ -764,6 +764,8 @@ impl Engine {
|
||||
// Import statement
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
Stmt::Import(x, _pos) => {
|
||||
use crate::ModuleResolver;
|
||||
|
||||
let (expr, export) = &**x;
|
||||
|
||||
// Guard against too many modules
|
||||
@@ -777,8 +779,6 @@ impl Engine {
|
||||
self.make_type_mismatch_err::<crate::ImmutableString>(typ, expr.position())
|
||||
})?;
|
||||
|
||||
use crate::ModuleResolver;
|
||||
|
||||
let path_pos = expr.start_position();
|
||||
|
||||
let resolver = global.embedded_module_resolver.clone();
|
||||
|
@@ -53,14 +53,12 @@ pub fn calc_index<E>(
|
||||
negative_count_from_end: bool,
|
||||
err_func: impl FnOnce() -> Result<usize, E>,
|
||||
) -> Result<usize, E> {
|
||||
if start < 0 {
|
||||
if negative_count_from_end {
|
||||
let abs_start = start.unsigned_abs() as usize;
|
||||
if start < 0 && negative_count_from_end {
|
||||
let abs_start = start.unsigned_abs() as usize;
|
||||
|
||||
// Count from end if negative
|
||||
if abs_start <= length {
|
||||
return Ok(length - abs_start);
|
||||
}
|
||||
// Count from end if negative
|
||||
if abs_start <= length {
|
||||
return Ok(length - abs_start);
|
||||
}
|
||||
}
|
||||
if start <= crate::MAX_USIZE_INT && (start as usize) < length {
|
||||
|
Reference in New Issue
Block a user