Extract index calculataion into functions.

This commit is contained in:
Stephen Chung
2022-01-13 18:13:27 +08:00
parent 4b4a6c944d
commit 0f4e8848f9
14 changed files with 328 additions and 558 deletions

View File

@@ -1,7 +1,7 @@
#![allow(non_snake_case)]
use crate::plugin::*;
use crate::{def_package, Position, RhaiResultOf, ERR, INT, UNSIGNED_INT};
use crate::{def_package, Position, RhaiResultOf, ERR, INT, UINT};
#[cfg(feature = "no_std")]
use std::prelude::v1::*;
@@ -118,7 +118,7 @@ mod int_functions {
.into());
}
UNSIGNED_INT::from_str_radix(string.trim(), radix as u32)
UINT::from_str_radix(string.trim(), radix as u32)
.map(|v| v as INT)
.map_err(|err| {
ERR::ErrorArithmetic(