Fix builds.

This commit is contained in:
Stephen Chung 2021-01-18 10:56:42 +08:00
parent ec272cf9b9
commit 4a8debb5ed
3 changed files with 17 additions and 10 deletions

View File

@ -7,9 +7,9 @@ use crate::stdlib::{
borrow::Cow,
boxed::Box,
fmt,
hash::{Hash, Hasher},
hash::Hash,
num::{NonZeroU64, NonZeroUsize},
ops::{Add, AddAssign, Deref, DerefMut},
ops::{Add, AddAssign},
string::String,
vec,
vec::Vec,
@ -1131,7 +1131,7 @@ pub struct FloatWrapper(FLOAT);
#[cfg(not(feature = "no_float"))]
impl Hash for FloatWrapper {
fn hash<H: Hasher>(&self, state: &mut H) {
fn hash<H: crate::stdlib::hash::Hasher>(&self, state: &mut H) {
self.0.to_le_bytes().hash(state);
}
}
@ -1151,7 +1151,7 @@ impl AsMut<FLOAT> for FloatWrapper {
}
#[cfg(not(feature = "no_float"))]
impl Deref for FloatWrapper {
impl crate::stdlib::ops::Deref for FloatWrapper {
type Target = FLOAT;
fn deref(&self) -> &Self::Target {
@ -1160,7 +1160,7 @@ impl Deref for FloatWrapper {
}
#[cfg(not(feature = "no_float"))]
impl DerefMut for FloatWrapper {
impl crate::stdlib::ops::DerefMut for FloatWrapper {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}

View File

@ -1676,9 +1676,8 @@ impl Module {
}
/// Get an iterator to the functions in the [`Module`].
#[cfg(not(feature = "no_optimize"))]
#[cfg(not(feature = "no_function"))]
#[inline(always)]
#[allow(dead_code)]
pub(crate) fn iter_fn(&self) -> impl Iterator<Item = &FuncInfo> {
self.functions.values()
}

View File

@ -145,7 +145,14 @@ impl From<&crate::module::FuncInfo> for FnMetadata {
.or_else(|| Some("()".to_string())),
signature: info.gen_signature(),
doc_comments: if info.func.is_script() {
info.func.get_fn_def().comments.clone()
#[cfg(feature = "no_function")]
{
unreachable!()
}
#[cfg(not(feature = "no_function"))]
{
info.func.get_fn_def().comments.clone()
}
} else {
Default::default()
},
@ -212,7 +219,7 @@ impl Engine {
/// 4) Functions in global modules (optional)
pub fn gen_fn_metadata_with_ast_to_json(
&self,
ast: &AST,
_ast: &AST,
include_global: bool,
) -> serde_json::Result<String> {
let mut global: ModuleMetadata = Default::default();
@ -233,7 +240,8 @@ impl Engine {
.map(|f| f.into())
.for_each(|info| global.functions.push(info));
ast.iter_functions()
#[cfg(not(feature = "no_function"))]
_ast.iter_functions()
.map(|f| f.into())
.for_each(|info| global.functions.push(info));