Change lib to &[Shared<Module>] and remove dummy lifetimes.
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
use crate::eval::{Caches, GlobalRuntimeState};
|
||||
use crate::types::dynamic::Variant;
|
||||
use crate::{
|
||||
reify, Dynamic, Engine, FuncArgs, Position, RhaiResult, RhaiResultOf, Scope, StaticVec, AST,
|
||||
ERR,
|
||||
reify, Dynamic, Engine, FuncArgs, Position, RhaiResult, RhaiResultOf, Scope, Shared, StaticVec,
|
||||
AST, ERR,
|
||||
};
|
||||
use std::any::{type_name, TypeId};
|
||||
#[cfg(feature = "no_std")]
|
||||
@@ -248,7 +248,7 @@ impl Engine {
|
||||
arg_values: &mut [Dynamic],
|
||||
) -> RhaiResult {
|
||||
let statements = ast.statements();
|
||||
let lib = &[ast.as_ref()];
|
||||
let lib = &[AsRef::<Shared<_>>::as_ref(ast).clone()];
|
||||
let mut this_ptr = this_ptr;
|
||||
|
||||
let orig_scope_len = scope.len();
|
||||
|
@@ -195,7 +195,7 @@ impl Engine {
|
||||
global.debugger.status = crate::eval::DebuggerStatus::Terminate;
|
||||
let lib = &[
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
ast.as_ref(),
|
||||
AsRef::<crate::Shared<_>>::as_ref(ast).clone(),
|
||||
];
|
||||
let node = &crate::ast::Stmt::Noop(Position::NONE);
|
||||
self.run_debugger(global, caches, lib, 0, scope, &mut None, node)?;
|
||||
@@ -234,7 +234,7 @@ impl Engine {
|
||||
|
||||
let mut _lib = &[
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
ast.as_ref(),
|
||||
AsRef::<crate::Shared<_>>::as_ref(ast).clone(),
|
||||
][..];
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
if !ast.has_functions() {
|
||||
@@ -264,7 +264,7 @@ impl Engine {
|
||||
&self,
|
||||
global: &mut GlobalRuntimeState,
|
||||
caches: &mut Caches,
|
||||
lib: &[&crate::Module],
|
||||
lib: &[crate::Shared<crate::Module>],
|
||||
level: usize,
|
||||
scope: &mut Scope,
|
||||
statements: &[crate::ast::Stmt],
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
use crate::eval::{Caches, GlobalRuntimeState};
|
||||
use crate::parser::ParseState;
|
||||
use crate::{Engine, Module, RhaiResultOf, Scope, AST};
|
||||
use crate::{Engine, RhaiResultOf, Scope, AST};
|
||||
#[cfg(feature = "no_std")]
|
||||
use std::prelude::v1::*;
|
||||
|
||||
@@ -124,9 +124,9 @@ impl Engine {
|
||||
if !statements.is_empty() {
|
||||
let lib = [
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
ast.as_ref(),
|
||||
AsRef::<crate::Shared<_>>::as_ref(ast).clone(),
|
||||
];
|
||||
let lib = if lib.first().map_or(true, |m: &&Module| m.is_empty()) {
|
||||
let lib = if lib.first().map_or(true, |m| m.is_empty()) {
|
||||
&lib[0..0]
|
||||
} else {
|
||||
&lib
|
||||
@@ -139,7 +139,7 @@ impl Engine {
|
||||
global.debugger.status = crate::eval::DebuggerStatus::Terminate;
|
||||
let lib = &[
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
ast.as_ref(),
|
||||
AsRef::<crate::Shared<_>>::as_ref(ast).clone(),
|
||||
];
|
||||
let node = &crate::ast::Stmt::Noop(crate::Position::NONE);
|
||||
self.run_debugger(global, caches, lib, 0, scope, &mut None, node)?;
|
||||
|
Reference in New Issue
Block a user