Fix feature builds.
This commit is contained in:
parent
4e3fdf6dab
commit
008ef0a41b
@ -607,6 +607,7 @@ impl Engine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Does a scripted function exist?
|
// Does a scripted function exist?
|
||||||
|
#[cfg(not(feature = "no_function"))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub(crate) fn has_script_fn(
|
pub(crate) fn has_script_fn(
|
||||||
&self,
|
&self,
|
||||||
@ -734,6 +735,7 @@ impl Engine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Scripted function call?
|
// Scripted function call?
|
||||||
|
#[cfg(not(feature = "no_function"))]
|
||||||
let hash_script = if hash.is_native_only() {
|
let hash_script = if hash.is_native_only() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
@ -240,20 +240,26 @@ fn optimize_stmt_block(
|
|||||||
.find_map(|(i, stmt)| match stmt {
|
.find_map(|(i, stmt)| match stmt {
|
||||||
stmt if !is_pure(stmt) => Some(i),
|
stmt if !is_pure(stmt) => Some(i),
|
||||||
|
|
||||||
Stmt::Noop(_) | Stmt::Return(_, None, _) | Stmt::Export(_, _) | Stmt::Share(_) => {
|
Stmt::Noop(_) | Stmt::Return(_, None, _) => None,
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
Stmt::Let(e, _, _, _)
|
Stmt::Let(e, _, _, _)
|
||||||
| Stmt::Const(e, _, _, _)
|
| Stmt::Const(e, _, _, _)
|
||||||
| Stmt::Expr(e)
|
| Stmt::Expr(e)
|
||||||
| Stmt::Return(_, Some(e), _)
|
| Stmt::Return(_, Some(e), _)
|
||||||
| Stmt::Import(e, _, _)
|
|
||||||
if e.is_constant() =>
|
if e.is_constant() =>
|
||||||
{
|
{
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "no_module"))]
|
||||||
|
Stmt::Import(e, _, _) if e.is_constant() => None,
|
||||||
|
|
||||||
|
#[cfg(not(feature = "no_module"))]
|
||||||
|
Stmt::Export(_, _) => None,
|
||||||
|
|
||||||
|
#[cfg(not(feature = "no_closure"))]
|
||||||
|
Stmt::Share(_) => None,
|
||||||
|
|
||||||
_ => Some(i),
|
_ => Some(i),
|
||||||
})
|
})
|
||||||
.map_or(0, |n| statements.len() - n);
|
.map_or(0, |n| statements.len() - n);
|
||||||
@ -370,8 +376,6 @@ fn optimize_stmt_block(
|
|||||||
state.set_dirty();
|
state.set_dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("{:?}", statements);
|
|
||||||
|
|
||||||
statements.shrink_to_fit();
|
statements.shrink_to_fit();
|
||||||
statements
|
statements
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user