Move level into GlobalRuntimeState.
This commit is contained in:
@@ -267,7 +267,7 @@ impl Engine {
|
||||
});
|
||||
|
||||
let result = if eval_ast && !statements.is_empty() {
|
||||
let r = self.eval_global_statements(global, caches, lib, 0, scope, statements);
|
||||
let r = self.eval_global_statements(global, caches, lib, scope, statements);
|
||||
|
||||
if rewind_scope {
|
||||
scope.rewind(orig_scope_len);
|
||||
@@ -289,7 +289,6 @@ impl Engine {
|
||||
global,
|
||||
caches,
|
||||
lib,
|
||||
0,
|
||||
scope,
|
||||
&mut this_ptr,
|
||||
fn_def,
|
||||
@@ -306,7 +305,7 @@ impl Engine {
|
||||
if self.debugger.is_some() {
|
||||
global.debugger.status = crate::eval::DebuggerStatus::Terminate;
|
||||
let node = &crate::ast::Stmt::Noop(Position::NONE);
|
||||
self.run_debugger(global, caches, lib, 0, scope, &mut this_ptr, node)?;
|
||||
self.run_debugger(global, caches, lib, scope, &mut this_ptr, node)?;
|
||||
}
|
||||
|
||||
Ok(result)
|
||||
|
@@ -4,7 +4,7 @@ use crate::func::RegisterNativeFunction;
|
||||
use crate::types::dynamic::Variant;
|
||||
use crate::{
|
||||
Dynamic, Engine, EvalAltResult, FnPtr, Identifier, ImmutableString, NativeCallContext,
|
||||
Position, RhaiResult, RhaiResultOf, Scope, AST,
|
||||
Position, RhaiResult, RhaiResultOf, Scope, SharedModule, AST,
|
||||
};
|
||||
#[cfg(feature = "no_std")]
|
||||
use std::prelude::v1::*;
|
||||
@@ -354,6 +354,26 @@ impl Dynamic {
|
||||
}
|
||||
|
||||
impl NativeCallContext<'_> {
|
||||
/// Create a new [`NativeCallContext`].
|
||||
///
|
||||
/// # Unimplemented
|
||||
///
|
||||
/// This method is deprecated. It is no longer implemented and always panics.
|
||||
///
|
||||
/// Use [`FnPtr::call`] to call a function pointer directly.
|
||||
///
|
||||
/// This method will be removed in the next major version.
|
||||
#[deprecated(
|
||||
since = "1.3.0",
|
||||
note = "use `FnPtr::call` to call a function pointer directly."
|
||||
)]
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
#[allow(unused_variables)]
|
||||
pub fn new(engine: &Engine, fn_name: &str, lib: &[SharedModule]) -> Self {
|
||||
unimplemented!("`NativeCallContext::new` is deprecated");
|
||||
}
|
||||
|
||||
/// Call a function inside the call context.
|
||||
///
|
||||
/// # Deprecated
|
||||
|
@@ -189,7 +189,7 @@ impl Engine {
|
||||
let global = &mut GlobalRuntimeState::new(self);
|
||||
let caches = &mut Caches::new();
|
||||
|
||||
let result = self.eval_ast_with_scope_raw(global, caches, 0, scope, ast)?;
|
||||
let result = self.eval_ast_with_scope_raw(global, caches, scope, ast)?;
|
||||
|
||||
#[cfg(feature = "debugging")]
|
||||
if self.debugger.is_some() {
|
||||
@@ -201,7 +201,7 @@ impl Engine {
|
||||
let mut this = Dynamic::NULL;
|
||||
let node = &crate::ast::Stmt::Noop(Position::NONE);
|
||||
|
||||
self.run_debugger(global, caches, lib, 0, scope, &mut this, node)?;
|
||||
self.run_debugger(global, caches, lib, scope, &mut this, node)?;
|
||||
}
|
||||
|
||||
let typ = self.map_type_name(result.type_name());
|
||||
@@ -217,7 +217,7 @@ impl Engine {
|
||||
&self,
|
||||
global: &mut GlobalRuntimeState,
|
||||
caches: &mut Caches,
|
||||
level: usize,
|
||||
|
||||
scope: &mut Scope,
|
||||
ast: &'a AST,
|
||||
) -> RhaiResult {
|
||||
@@ -244,7 +244,7 @@ impl Engine {
|
||||
AsRef::<crate::SharedModule>::as_ref(ast).clone(),
|
||||
];
|
||||
|
||||
self.eval_global_statements(global, caches, lib, level, scope, statements)
|
||||
self.eval_global_statements(global, caches, lib, scope, statements)
|
||||
}
|
||||
/// _(internals)_ Evaluate a list of statements with no `this` pointer.
|
||||
/// Exported under the `internals` feature only.
|
||||
@@ -261,11 +261,11 @@ impl Engine {
|
||||
global: &mut GlobalRuntimeState,
|
||||
caches: &mut Caches,
|
||||
lib: &[crate::SharedModule],
|
||||
level: usize,
|
||||
|
||||
scope: &mut Scope,
|
||||
statements: &[crate::ast::Stmt],
|
||||
) -> RhaiResult {
|
||||
self.eval_global_statements(global, caches, lib, level, scope, statements)
|
||||
self.eval_global_statements(global, caches, lib, scope, statements)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -131,7 +131,7 @@ impl Engine {
|
||||
} else {
|
||||
&lib
|
||||
};
|
||||
self.eval_global_statements(global, caches, lib, 0, scope, statements)?;
|
||||
self.eval_global_statements(global, caches, lib, scope, statements)?;
|
||||
}
|
||||
|
||||
#[cfg(feature = "debugging")]
|
||||
@@ -143,7 +143,7 @@ impl Engine {
|
||||
];
|
||||
let mut this = crate::Dynamic::NULL;
|
||||
let node = &crate::ast::Stmt::Noop(crate::Position::NONE);
|
||||
self.run_debugger(global, caches, lib, 0, scope, &mut this, node)?;
|
||||
self.run_debugger(global, caches, lib, scope, &mut this, node)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
Reference in New Issue
Block a user