Refactor and add state to debugger.
This commit is contained in:
@@ -61,24 +61,21 @@ fn print_help() {
|
||||
|
||||
/// Display the scope.
|
||||
fn print_scope(scope: &Scope) {
|
||||
scope
|
||||
.iter_raw()
|
||||
.enumerate()
|
||||
.for_each(|(i, (name, constant, value))| {
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
let value_is_shared = if value.is_shared() { " (shared)" } else { "" };
|
||||
#[cfg(feature = "no_closure")]
|
||||
let value_is_shared = "";
|
||||
for (i, (name, constant, value)) in scope.iter_raw().enumerate() {
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
let value_is_shared = if value.is_shared() { " (shared)" } else { "" };
|
||||
#[cfg(feature = "no_closure")]
|
||||
let value_is_shared = "";
|
||||
|
||||
println!(
|
||||
"[{}] {}{}{} = {:?}",
|
||||
i + 1,
|
||||
if constant { "const " } else { "" },
|
||||
name,
|
||||
value_is_shared,
|
||||
*value.read_lock::<Dynamic>().unwrap(),
|
||||
)
|
||||
});
|
||||
println!(
|
||||
"[{}] {}{}{} = {:?}",
|
||||
i + 1,
|
||||
if constant { "const " } else { "" },
|
||||
name,
|
||||
value_is_shared,
|
||||
*value.read_lock::<Dynamic>().unwrap(),
|
||||
)
|
||||
}
|
||||
|
||||
println!();
|
||||
}
|
||||
@@ -282,13 +279,13 @@ fn main() {
|
||||
#[cfg(feature = "metadata")]
|
||||
"functions" => {
|
||||
// print a list of all registered functions
|
||||
engine
|
||||
.gen_fn_signatures(false)
|
||||
.into_iter()
|
||||
.for_each(|f| println!("{}", f));
|
||||
for f in engine.gen_fn_signatures(false) {
|
||||
println!("{}", f)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
main_ast.iter_functions().for_each(|f| println!("{}", f));
|
||||
for f in main_ast.iter_functions() {
|
||||
println!("{}", f)
|
||||
}
|
||||
|
||||
println!();
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user