Rename EvalState to Caches.

This commit is contained in:
Stephen Chung
2022-04-16 16:36:53 +08:00
parent b696390c13
commit 855cb76246
19 changed files with 349 additions and 354 deletions

View File

@@ -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(())
}