Add Start/End to DebuggerEvent.

This commit is contained in:
Stephen Chung
2022-04-26 16:36:24 +08:00
parent 34dfe841cd
commit 2889ca0988
13 changed files with 96 additions and 39 deletions

View File

@@ -10,6 +10,7 @@ use std::prelude::v1::*;
/// A type encapsulating a function callable by Rhai.
#[derive(Clone)]
#[non_exhaustive]
pub enum CallableFunction {
/// A pure native Rust function with all arguments passed by value.
Pure(Shared<FnAny>),

View File

@@ -1,7 +1,6 @@
//! Module defining interfaces to native-Rust functions.
use super::call::FnCallArgs;
use crate::api::events::VarDefInfo;
use crate::ast::FnCallHashes;
use crate::eval::{Caches, GlobalRuntimeState};
use crate::plugin::PluginFunction;
@@ -9,7 +8,7 @@ use crate::tokenizer::{Token, TokenizeState};
use crate::types::dynamic::Variant;
use crate::{
calc_fn_hash, Dynamic, Engine, EvalContext, FuncArgs, Module, Position, RhaiResult,
RhaiResultOf, StaticVec, ERR,
RhaiResultOf, StaticVec, VarDefInfo, ERR,
};
use std::any::type_name;
#[cfg(feature = "no_std")]

View File

@@ -121,9 +121,11 @@ impl Engine {
ref constants,
}) = fn_def.environ
{
for (n, m) in imports.iter().cloned() {
global.push_import(n, m)
}
imports
.iter()
.cloned()
.for_each(|(n, m)| global.push_import(n, m));
(
if fn_lib.is_empty() {
lib
@@ -167,7 +169,6 @@ impl Engine {
} else {
format!("{} @ '{}' < {}", name, src, fn_def.name)
};
make_error(fn_name, fn_def, global, err, pos)
}
// System errors are passed straight-through