Refactor OptimizationLevel.

This commit is contained in:
Stephen Chung
2022-02-07 21:03:39 +08:00
parent 556b2393f5
commit 187a20fd8b
9 changed files with 34 additions and 36 deletions

View File

@@ -12,7 +12,8 @@ use crate::engine::{
use crate::eval::{EvalState, GlobalRuntimeState};
use crate::{
calc_fn_hash, calc_fn_params_hash, combine_hashes, Dynamic, Engine, FnArgsVec, FnPtr,
Identifier, ImmutableString, Module, Position, RhaiResult, RhaiResultOf, Scope, ERR,
Identifier, ImmutableString, Module, OptimizationLevel, Position, RhaiResult, RhaiResultOf,
Scope, ERR,
};
#[cfg(feature = "no_std")]
use std::prelude::v1::*;
@@ -1450,7 +1451,9 @@ impl Engine {
&Scope::new(),
&[script],
#[cfg(not(feature = "no_optimize"))]
crate::OptimizationLevel::None,
OptimizationLevel::None,
#[cfg(feature = "no_optimize")]
OptimizationLevel::default(),
)?;
// If new functions are defined within the eval string, it is an error