Fix builds.

This commit is contained in:
Stephen Chung 2021-10-21 19:30:58 +08:00
parent 65ef402440
commit 83f83307ca
2 changed files with 8 additions and 3 deletions

View File

@ -322,7 +322,7 @@ mod decimal_functions {
#[cfg(feature = "no_float")] #[cfg(feature = "no_float")]
#[rhai_fn(return_raw)] #[rhai_fn(return_raw)]
pub fn parse_float(s: &str) -> Result<Decimal, Box<EvalAltResult>> { pub fn parse_float(s: &str) -> Result<Decimal, Box<EvalAltResult>> {
super::parse_decimal(s) parse_decimal(s)
} }
pub fn sin(x: Decimal) -> Decimal { pub fn sin(x: Decimal) -> Decimal {

View File

@ -3332,18 +3332,19 @@ impl Engine {
#[cfg(not(feature = "no_optimize"))] optimization_level: crate::OptimizationLevel, #[cfg(not(feature = "no_optimize"))] optimization_level: crate::OptimizationLevel,
) -> Result<AST, ParseError> { ) -> Result<AST, ParseError> {
let _scope = scope; let _scope = scope;
let (statements, lib) = self.parse_global_level(input, state)?; let (statements, _lib) = self.parse_global_level(input, state)?;
#[cfg(not(feature = "no_optimize"))] #[cfg(not(feature = "no_optimize"))]
return Ok(crate::optimize::optimize_into_ast( return Ok(crate::optimize::optimize_into_ast(
self, self,
_scope, _scope,
statements, statements,
lib, _lib,
optimization_level, optimization_level,
)); ));
#[cfg(feature = "no_optimize")] #[cfg(feature = "no_optimize")]
#[cfg(not(feature = "no_function"))]
{ {
let mut m = crate::Module::new(); let mut m = crate::Module::new();
@ -3353,5 +3354,9 @@ impl Engine {
return Ok(AST::new(statements, m)); return Ok(AST::new(statements, m));
} }
#[cfg(feature = "no_optimize")]
#[cfg(feature = "no_function")]
return Ok(AST::new(statements, crate::Module::new()));
} }
} }