Fix no_function and no_module builds.

This commit is contained in:
Stephen Chung
2020-10-18 17:29:11 +08:00
parent 232ff91957
commit dc4c47e008
2 changed files with 20 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
//! Module defining interfaces to native-Rust functions.
use crate::any::Dynamic;
use crate::engine::{Engine, EvalContext, FN_ANONYMOUS};
use crate::engine::{Engine, EvalContext};
use crate::module::Module;
use crate::parser::{FnAccess, ScriptFnDef};
use crate::plugin::PluginFunction;
@@ -11,6 +11,9 @@ use crate::token::{is_valid_identifier, Position};
use crate::utils::ImmutableString;
use crate::{calc_fn_hash, StaticVec};
#[cfg(not(feature = "no_function"))]
use crate::engine::FN_ANONYMOUS;
use crate::stdlib::{boxed::Box, convert::TryFrom, fmt, iter::empty, mem, string::String};
#[cfg(feature = "sync")]
@@ -138,6 +141,7 @@ impl FnPtr {
self.1.as_ref()
}
/// Does this function pointer refer to an anonymous function?
#[cfg(not(feature = "no_function"))]
#[inline(always)]
pub fn is_anonymous(&self) -> bool {
self.0.starts_with(FN_ANONYMOUS)