Fix builds.

This commit is contained in:
Stephen Chung
2022-11-19 18:57:15 +08:00
parent 62d707ff84
commit 4304da7a47
7 changed files with 39 additions and 34 deletions

View File

@@ -166,7 +166,7 @@ impl Engine {
#[must_use]
fn resolve_fn<'s>(
&self,
global: &GlobalRuntimeState,
_global: &GlobalRuntimeState,
caches: &'s mut Caches,
local_entry: &'s mut Option<FnResolutionCacheEntry>,
op_token: Option<&Token>,
@@ -194,7 +194,7 @@ impl Engine {
loop {
#[cfg(not(feature = "no_function"))]
let func = global
let func = _global
.lib
.iter()
.rev()
@@ -214,7 +214,7 @@ impl Engine {
// Scripted functions are not exposed globally
func
} else {
func.or_else(|| global.get_qualified_fn(hash)).or_else(|| {
func.or_else(|| _global.get_qualified_fn(hash)).or_else(|| {
self.global_sub_modules
.values()
.find_map(|m| m.get_qualified_fn(hash).map(|f| (f, m.id_raw())))
@@ -246,14 +246,14 @@ impl Engine {
#[cfg(not(feature = "no_function"))]
let is_dynamic = is_dynamic
|| global
|| _global
.lib
.iter()
.any(|m| m.may_contain_dynamic_fn(hash_base));
#[cfg(not(feature = "no_module"))]
let is_dynamic = is_dynamic
|| global.may_contain_dynamic_fn(hash_base)
|| _global.may_contain_dynamic_fn(hash_base)
|| self
.global_sub_modules
.values()

View File

@@ -7,8 +7,8 @@ use crate::plugin::PluginFunction;
use crate::tokenizer::{is_valid_function_name, Token, TokenizeState};
use crate::types::dynamic::Variant;
use crate::{
calc_fn_hash, Dynamic, Engine, EvalContext, FuncArgs, Module, Position, RhaiResult,
RhaiResultOf, SharedModule, StaticVec, VarDefInfo, ERR,
calc_fn_hash, Dynamic, Engine, EvalContext, FuncArgs, Position, RhaiResult, RhaiResultOf,
StaticVec, VarDefInfo, ERR,
};
use std::any::type_name;
#[cfg(feature = "no_std")]
@@ -249,7 +249,7 @@ impl<'a> NativeCallContext<'a> {
/// Not available under `no_module`.
#[cfg(not(feature = "no_module"))]
#[inline]
pub fn iter_imports(&self) -> impl Iterator<Item = (&str, &Module)> {
pub fn iter_imports(&self) -> impl Iterator<Item = (&str, &crate::Module)> {
self.global.iter_imports()
}
/// Get an iterator over the current set of modules imported via `import` statements in reverse order.
@@ -258,7 +258,7 @@ impl<'a> NativeCallContext<'a> {
#[inline]
pub(crate) fn iter_imports_raw(
&self,
) -> impl Iterator<Item = (&crate::ImmutableString, &SharedModule)> {
) -> impl Iterator<Item = (&crate::ImmutableString, &crate::SharedModule)> {
self.global.iter_imports_raw()
}
/// _(internals)_ The current [`GlobalRuntimeState`], if any.
@@ -277,7 +277,7 @@ impl<'a> NativeCallContext<'a> {
/// Not available under `no_function`.
#[cfg(not(feature = "no_function"))]
#[inline]
pub fn iter_namespaces(&self) -> impl Iterator<Item = &Module> {
pub fn iter_namespaces(&self) -> impl Iterator<Item = &crate::Module> {
self.global.lib.iter().map(|m| m.as_ref())
}
/// _(internals)_ The current stack of namespaces containing definitions of all script-defined functions.
@@ -288,7 +288,7 @@ impl<'a> NativeCallContext<'a> {
#[cfg(feature = "internals")]
#[inline(always)]
#[must_use]
pub fn namespaces(&self) -> &[SharedModule] {
pub fn namespaces(&self) -> &[crate::SharedModule] {
&self.global.lib
}
/// Call a function inside the call context with the provided arguments.