Fix builds.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//! Evaluation context.
|
||||
|
||||
use super::{Caches, GlobalRuntimeState};
|
||||
use crate::{Dynamic, Engine, Module, Scope};
|
||||
use crate::{Dynamic, Engine, Scope};
|
||||
#[cfg(feature = "no_std")]
|
||||
use std::prelude::v1::*;
|
||||
|
||||
@@ -68,7 +68,7 @@ impl<'a, 's, 'ps, 'g, 'c, 't> EvalContext<'a, 's, 'ps, 'g, 'c, 't> {
|
||||
/// in reverse order (i.e. modules imported last come first).
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
#[inline(always)]
|
||||
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()
|
||||
}
|
||||
/// Custom state kept in a [`Dynamic`].
|
||||
@@ -104,7 +104,7 @@ impl<'a, 's, 'ps, 'g, 'c, 't> EvalContext<'a, 's, 'ps, 'g, 'c, 't> {
|
||||
/// 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 set of namespaces containing definitions of all script-defined functions.
|
||||
|
@@ -4,7 +4,7 @@ use super::{Caches, EvalContext, GlobalRuntimeState, Target};
|
||||
use crate::ast::{Expr, OpAssignment};
|
||||
use crate::engine::{KEYWORD_THIS, OP_CONCAT};
|
||||
use crate::types::dynamic::AccessMode;
|
||||
use crate::{Dynamic, Engine, Position, RhaiResult, RhaiResultOf, Scope, SharedModule, ERR};
|
||||
use crate::{Dynamic, Engine, Position, RhaiResult, RhaiResultOf, Scope, ERR};
|
||||
use std::num::NonZeroUsize;
|
||||
#[cfg(feature = "no_std")]
|
||||
use std::prelude::v1::*;
|
||||
@@ -18,7 +18,7 @@ impl Engine {
|
||||
&self,
|
||||
global: &GlobalRuntimeState,
|
||||
namespace: &crate::ast::Namespace,
|
||||
) -> Option<SharedModule> {
|
||||
) -> Option<crate::SharedModule> {
|
||||
assert!(!namespace.is_empty());
|
||||
|
||||
let root = namespace.root();
|
||||
|
@@ -1,6 +1,6 @@
|
||||
//! Global runtime state.
|
||||
|
||||
use crate::{Dynamic, Engine, ImmutableString, SharedModule, StaticVec};
|
||||
use crate::{Dynamic, Engine, ImmutableString};
|
||||
use std::fmt;
|
||||
#[cfg(feature = "no_std")]
|
||||
use std::prelude::v1::*;
|
||||
@@ -25,13 +25,13 @@ pub type GlobalConstants =
|
||||
pub struct GlobalRuntimeState {
|
||||
/// Names of imported [modules][crate::Module].
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
imports: StaticVec<ImmutableString>,
|
||||
imports: crate::StaticVec<ImmutableString>,
|
||||
/// Stack of imported [modules][crate::Module].
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
modules: StaticVec<SharedModule>,
|
||||
modules: crate::StaticVec<crate::SharedModule>,
|
||||
/// The current stack of loaded [modules][crate::Module] containing script-defined functions.
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
pub lib: StaticVec<SharedModule>,
|
||||
pub lib: crate::StaticVec<crate::SharedModule>,
|
||||
/// Source of the current context.
|
||||
///
|
||||
/// No source if the string is empty.
|
||||
@@ -84,11 +84,11 @@ impl GlobalRuntimeState {
|
||||
pub fn new(engine: &Engine) -> Self {
|
||||
Self {
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
imports: StaticVec::new_const(),
|
||||
imports: crate::StaticVec::new_const(),
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
modules: StaticVec::new_const(),
|
||||
modules: crate::StaticVec::new_const(),
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
lib: StaticVec::new_const(),
|
||||
lib: crate::StaticVec::new_const(),
|
||||
source: None,
|
||||
num_operations: 0,
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
@@ -135,7 +135,7 @@ impl GlobalRuntimeState {
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
pub fn get_shared_import(&self, index: usize) -> Option<SharedModule> {
|
||||
pub fn get_shared_import(&self, index: usize) -> Option<crate::SharedModule> {
|
||||
self.modules.get(index).cloned()
|
||||
}
|
||||
/// Get a mutable reference to the globally-imported [module][crate::Module] at a
|
||||
@@ -146,7 +146,10 @@ impl GlobalRuntimeState {
|
||||
#[allow(dead_code)]
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
pub(crate) fn get_shared_import_mut(&mut self, index: usize) -> Option<&mut SharedModule> {
|
||||
pub(crate) fn get_shared_import_mut(
|
||||
&mut self,
|
||||
index: usize,
|
||||
) -> Option<&mut crate::SharedModule> {
|
||||
self.modules.get_mut(index)
|
||||
}
|
||||
/// Get the index of a globally-imported [module][crate::Module] by name.
|
||||
@@ -170,7 +173,7 @@ impl GlobalRuntimeState {
|
||||
pub fn push_import(
|
||||
&mut self,
|
||||
name: impl Into<ImmutableString>,
|
||||
module: impl Into<SharedModule>,
|
||||
module: impl Into<crate::SharedModule>,
|
||||
) {
|
||||
self.imports.push(name.into());
|
||||
self.modules.push(module.into());
|
||||
@@ -203,7 +206,7 @@ impl GlobalRuntimeState {
|
||||
#[inline]
|
||||
pub(crate) fn iter_imports_raw(
|
||||
&self,
|
||||
) -> impl Iterator<Item = (&ImmutableString, &SharedModule)> {
|
||||
) -> impl Iterator<Item = (&ImmutableString, &crate::SharedModule)> {
|
||||
self.imports.iter().zip(self.modules.iter()).rev()
|
||||
}
|
||||
/// Get an iterator to the stack of globally-imported [modules][crate::Module] in forward order.
|
||||
@@ -211,7 +214,9 @@ impl GlobalRuntimeState {
|
||||
/// Not available under `no_module`.
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
#[inline]
|
||||
pub fn scan_imports_raw(&self) -> impl Iterator<Item = (&ImmutableString, &SharedModule)> {
|
||||
pub fn scan_imports_raw(
|
||||
&self,
|
||||
) -> impl Iterator<Item = (&ImmutableString, &crate::SharedModule)> {
|
||||
self.imports.iter().zip(self.modules.iter())
|
||||
}
|
||||
/// Can the particular function with [`Dynamic`] parameter(s) exist in the stack of
|
||||
@@ -318,7 +323,7 @@ impl GlobalRuntimeState {
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
impl<K: Into<ImmutableString>, M: Into<SharedModule>> Extend<(K, M)> for GlobalRuntimeState {
|
||||
impl<K: Into<ImmutableString>, M: Into<crate::SharedModule>> Extend<(K, M)> for GlobalRuntimeState {
|
||||
#[inline]
|
||||
fn extend<T: IntoIterator<Item = (K, M)>>(&mut self, iter: T) {
|
||||
for (k, m) in iter {
|
||||
|
@@ -25,7 +25,7 @@ pub use target::{calc_index, calc_offset_len, Target};
|
||||
|
||||
#[cfg(feature = "unchecked")]
|
||||
mod unchecked {
|
||||
use crate::{eval::GlobalRuntimeState, Dynamic, Engine, Position, RhaiResult, RhaiResultOf};
|
||||
use crate::{eval::GlobalRuntimeState, Dynamic, Engine, Position, RhaiResultOf};
|
||||
use std::borrow::Borrow;
|
||||
#[cfg(feature = "no_std")]
|
||||
use std::prelude::v1::*;
|
||||
|
@@ -8,7 +8,7 @@ use crate::ast::{
|
||||
use crate::func::{get_builtin_op_assignment_fn, get_hasher};
|
||||
use crate::types::dynamic::AccessMode;
|
||||
use crate::types::RestoreOnDrop;
|
||||
use crate::{Dynamic, Engine, ImmutableString, RhaiResult, RhaiResultOf, Scope, ERR, INT};
|
||||
use crate::{Dynamic, Engine, RhaiResult, RhaiResultOf, Scope, ERR, INT};
|
||||
use std::hash::{Hash, Hasher};
|
||||
#[cfg(feature = "no_std")]
|
||||
use std::prelude::v1::*;
|
||||
@@ -228,7 +228,7 @@ impl Engine {
|
||||
// (returned by a variable resolver, for example)
|
||||
let is_temp_result = !target.is_ref() && !target.is_shared();
|
||||
#[cfg(feature = "no_closure")]
|
||||
let is_temp_result = !lhs_ptr.is_ref();
|
||||
let is_temp_result = !target.is_ref();
|
||||
|
||||
// Cannot assign to temp result from expression
|
||||
if is_temp_result {
|
||||
@@ -773,8 +773,8 @@ impl Engine {
|
||||
|
||||
let v = self.eval_expr(global, caches, scope, this_ptr, expr)?;
|
||||
let typ = v.type_name();
|
||||
let path = v.try_cast::<ImmutableString>().ok_or_else(|| {
|
||||
self.make_type_mismatch_err::<ImmutableString>(typ, expr.position())
|
||||
let path = v.try_cast::<crate::ImmutableString>().ok_or_else(|| {
|
||||
self.make_type_mismatch_err::<crate::ImmutableString>(typ, expr.position())
|
||||
})?;
|
||||
|
||||
use crate::ModuleResolver;
|
||||
|
Reference in New Issue
Block a user