Fix builds.

This commit is contained in:
Stephen Chung 2021-12-17 16:32:34 +08:00
parent 42638db0fb
commit 29a9b3878d
3 changed files with 5 additions and 9 deletions

View File

@ -8,12 +8,15 @@ pub mod script_fn;
pub mod stmt; pub mod stmt;
pub use ast::{ASTNode, AST}; pub use ast::{ASTNode, AST};
pub use expr::{BinaryExpr, CustomExpr, Expr, FloatWrapper, FnCallExpr, FnCallHashes}; pub use expr::{BinaryExpr, CustomExpr, Expr, FnCallExpr, FnCallHashes};
pub use flags::{FnAccess, OptionFlags, AST_OPTION_FLAGS}; pub use flags::{FnAccess, OptionFlags, AST_OPTION_FLAGS};
pub use ident::Ident; pub use ident::Ident;
#[cfg(not(feature = "no_function"))] #[cfg(not(feature = "no_function"))]
pub use script_fn::{ScriptFnDef, ScriptFnMetadata}; pub use script_fn::{ScriptFnDef, ScriptFnMetadata};
pub use stmt::{OpAssignment, Stmt, StmtBlock}; pub use stmt::{OpAssignment, Stmt, StmtBlock};
#[cfg(not(feature = "no_float"))]
pub use expr::FloatWrapper;
#[cfg(feature = "no_function")] #[cfg(feature = "no_function")]
pub struct ScriptFnDef; pub struct ScriptFnDef;

View File

@ -551,10 +551,6 @@ mod range_functions {
let _range = range; let _range = range;
true true
} }
#[rhai_fn(get = "is_empty", name = "is_empty", pure)]
pub fn is_empty(range: &mut ExclusiveRange) -> bool {
range.is_empty()
}
#[rhai_fn(get = "start", name = "start", pure)] #[rhai_fn(get = "start", name = "start", pure)]
pub fn start_inclusive(range: &mut InclusiveRange) -> INT { pub fn start_inclusive(range: &mut InclusiveRange) -> INT {
*range.start() *range.start()
@ -567,10 +563,6 @@ mod range_functions {
pub fn contains_inclusive(range: &mut InclusiveRange, value: INT) -> bool { pub fn contains_inclusive(range: &mut InclusiveRange, value: INT) -> bool {
range.contains(&value) range.contains(&value)
} }
#[rhai_fn(get = "is_empty", name = "is_empty", pure)]
pub fn is_empty_inclusive(range: &mut InclusiveRange) -> bool {
range.is_empty()
}
#[rhai_fn(get = "is_inclusive", name = "is_inclusive", pure)] #[rhai_fn(get = "is_inclusive", name = "is_inclusive", pure)]
pub fn is_inclusive_inclusive(range: &mut InclusiveRange) -> bool { pub fn is_inclusive_inclusive(range: &mut InclusiveRange) -> bool {
let _range = range; let _range = range;

View File

@ -267,6 +267,7 @@ fn test_custom_syntax_raw2() -> Result<(), Box<EvalAltResult>> {
assert_eq!(engine.eval::<INT>("#-1")?, -1); assert_eq!(engine.eval::<INT>("#-1")?, -1);
assert_eq!(engine.eval::<INT>("let x = 41; x + #1")?, 42); assert_eq!(engine.eval::<INT>("let x = 41; x + #1")?, 42);
#[cfg(not(feature = "no_object"))]
assert_eq!(engine.eval::<INT>("#-42.abs()")?, 42); assert_eq!(engine.eval::<INT>("#-42.abs()")?, 42);
assert_eq!(engine.eval::<INT>("#42/2")?, 21); assert_eq!(engine.eval::<INT>("#42/2")?, 21);
assert_eq!(engine.eval::<INT>("sign(#1)")?, 1); assert_eq!(engine.eval::<INT>("sign(#1)")?, 1);