Rename EvalState to Caches.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//! Module that defines the `call_fn` API of [`Engine`].
|
||||
#![cfg(not(feature = "no_function"))]
|
||||
|
||||
use crate::eval::{EvalState, GlobalRuntimeState};
|
||||
use crate::eval::{Caches, GlobalRuntimeState};
|
||||
use crate::types::dynamic::Variant;
|
||||
use crate::{
|
||||
Dynamic, Engine, FuncArgs, Position, RhaiResult, RhaiResultOf, Scope, StaticVec, AST, ERR,
|
||||
@@ -149,7 +149,7 @@ impl Engine {
|
||||
this_ptr: Option<&mut Dynamic>,
|
||||
arg_values: impl AsMut<[Dynamic]>,
|
||||
) -> RhaiResult {
|
||||
let state = &mut EvalState::new();
|
||||
let caches = &mut Caches::new();
|
||||
let global = &mut GlobalRuntimeState::new(self);
|
||||
|
||||
let statements = ast.statements();
|
||||
@@ -157,7 +157,7 @@ impl Engine {
|
||||
let orig_scope_len = scope.len();
|
||||
|
||||
if eval_ast && !statements.is_empty() {
|
||||
self.eval_global_statements(scope, global, state, statements, &[ast.as_ref()], 0)?;
|
||||
self.eval_global_statements(scope, global, caches, statements, &[ast.as_ref()], 0)?;
|
||||
|
||||
if rewind_scope {
|
||||
scope.rewind(orig_scope_len);
|
||||
@@ -181,7 +181,7 @@ impl Engine {
|
||||
self.call_script_fn(
|
||||
scope,
|
||||
global,
|
||||
state,
|
||||
caches,
|
||||
&[ast.as_ref()],
|
||||
&mut this_ptr,
|
||||
fn_def,
|
||||
|
@@ -130,7 +130,7 @@ impl Deref for Expression<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
impl EvalContext<'_, '_, '_, '_, '_, '_, '_, '_, '_, '_> {
|
||||
impl EvalContext<'_, '_, '_, '_, '_, '_, '_, '_, '_> {
|
||||
/// Evaluate an [expression tree][Expression].
|
||||
///
|
||||
/// # WARNING - Low Level API
|
||||
@@ -141,7 +141,7 @@ impl EvalContext<'_, '_, '_, '_, '_, '_, '_, '_, '_, '_> {
|
||||
self.engine.eval_expr(
|
||||
self.scope,
|
||||
self.global,
|
||||
self.state,
|
||||
self.caches,
|
||||
self.lib,
|
||||
self.this_ptr,
|
||||
expr,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
//! Module that defines the public evaluation API of [`Engine`].
|
||||
|
||||
use crate::eval::{EvalState, GlobalRuntimeState};
|
||||
use crate::eval::{Caches, GlobalRuntimeState};
|
||||
use crate::parser::ParseState;
|
||||
use crate::types::dynamic::Variant;
|
||||
use crate::{
|
||||
@@ -208,7 +208,7 @@ impl Engine {
|
||||
ast: &'a AST,
|
||||
level: usize,
|
||||
) -> RhaiResult {
|
||||
let mut state = EvalState::new();
|
||||
let mut caches = Caches::new();
|
||||
global.source = ast.source_raw().clone();
|
||||
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
@@ -231,6 +231,6 @@ impl Engine {
|
||||
} else {
|
||||
&lib[..]
|
||||
};
|
||||
self.eval_global_statements(scope, global, &mut state, statements, lib, level)
|
||||
self.eval_global_statements(scope, global, &mut caches, statements, lib, level)
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
//! Module that defines the public evaluation API of [`Engine`].
|
||||
|
||||
use crate::eval::{EvalState, GlobalRuntimeState};
|
||||
use crate::eval::{Caches, GlobalRuntimeState};
|
||||
use crate::parser::ParseState;
|
||||
use crate::{Engine, Module, RhaiResultOf, Scope, AST};
|
||||
#[cfg(feature = "no_std")]
|
||||
@@ -43,7 +43,7 @@ impl Engine {
|
||||
/// Evaluate an [`AST`] with own scope, returning any error (if any).
|
||||
#[inline]
|
||||
pub fn run_ast_with_scope(&self, scope: &mut Scope, ast: &AST) -> RhaiResultOf<()> {
|
||||
let state = &mut EvalState::new();
|
||||
let caches = &mut Caches::new();
|
||||
let global = &mut GlobalRuntimeState::new(self);
|
||||
global.source = ast.source_raw().clone();
|
||||
|
||||
@@ -63,7 +63,7 @@ impl Engine {
|
||||
} else {
|
||||
&lib
|
||||
};
|
||||
self.eval_global_statements(scope, global, state, statements, lib, 0)?;
|
||||
self.eval_global_statements(scope, global, caches, statements, lib, 0)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user