diff --git a/src/cli.rs b/src/cli.rs index 48ba434..7011315 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -266,7 +266,7 @@ fn run_proj_tty>>(project_name: &str, server: String for _ in 0..STEPS_PER_IO_ITER { let res = proj.step(mc); if let ProjectStep::Error { error, proc } = &res { - print!("\r\n>>> runtime error in entity {:?}: {:?}\r\n\r\n", proc.get_call_stack().last().unwrap().entity.borrow().name, error.cause); + print!("\r\n>>> runtime error: {:?}\r\n\r\n", error.cause); } idle_sleeper.consume(&res); } @@ -326,7 +326,7 @@ fn run_proj_non_tty>>(project_name: &str, server: St for _ in 0..STEPS_PER_IO_ITER { let res = proj.step(mc); if let ProjectStep::Error { error, proc } = &res { - println!("\n>>> runtime error in entity {:?}: {:?}\n", proc.get_call_stack().last().unwrap().entity.borrow().name, error.cause); + println!("\n>>> runtime error: {:?}\n", error.cause); } idle_sleeper.consume(&res); } diff --git a/src/main.rs b/src/main.rs index f7cd96e..35cf702 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ use std::io::{BufRead, Write, BufReader, BufWriter}; use netsblox_vm::cli::{run, Mode}; use netsblox_vm::template::SyscallMenu; -use netsblox_vm::runtime::{GetType, Value, Type, ErrorCause, EntityKind, Request, RequestStatus, Config, CustomTypes, Key, SimpleValue}; +use netsblox_vm::runtime::{GetType, Value, Type, ErrorCause, EntityKind, Request, RequestStatus, Config, CustomTypes, Key, SimpleValue, Entity}; use netsblox_vm::std_system::StdSystem; use netsblox_vm::gc::Mutation; use clap::Parser; @@ -47,6 +47,13 @@ impl From>> for EntityState { } } +struct ProcessState; +impl From<&Entity<'_, C, StdSystem>> for ProcessState { + fn from(_: &Entity<'_, C, StdSystem>) -> Self { + ProcessState + } +} + enum Intermediate { Simple(SimpleValue), Native(NativeValue), @@ -63,6 +70,7 @@ impl CustomTypes> for C { type Intermediate = Intermediate; type EntityState = EntityState; + type ProcessState = ProcessState; fn from_intermediate<'gc>(mc: &Mutation<'gc>, value: Self::Intermediate) -> Result>, ErrorCause>> { Ok(match value { diff --git a/src/process.rs b/src/process.rs index c4e5101..343b1ae 100644 --- a/src/process.rs +++ b/src/process.rs @@ -81,14 +81,13 @@ impl ErrorSummary { let globals = summarize_symbols(&process.get_global_context().borrow().globals); let fields = summarize_symbols(&raw_entity.borrow().fields); - let call_stack = process.get_call_stack(); - let mut trace = Vec::with_capacity(call_stack.len()); - for (pos, locals) in iter::zip(call_stack[1..].iter().map(|x| x.called_from).chain(iter::once(error.pos)), call_stack.iter().map(|x| &x.locals)) { + let mut trace = Vec::with_capacity(process.call_stack.len()); + for (pos, locals) in iter::zip(process.call_stack[1..].iter().map(|x| x.called_from).chain(iter::once(error.pos)), process.call_stack.iter().map(|x| &x.locals)) { if let Some(loc) = locations.lookup(pos) { trace.push(TraceEntry { location: loc.clone(), locals: summarize_symbols(locals) }); } } - debug_assert_eq!(trace.len(), call_stack.len()); + debug_assert_eq!(trace.len(), process.call_stack.len()); Self { entity, cause, globals, fields, trace } } @@ -146,10 +145,10 @@ pub enum ProcessStep<'gc, C: CustomTypes, S: System> { #[derive(Collect)] #[collect(no_drop, bound = "")] pub struct CallStackEntry<'gc, C: CustomTypes, S: System> { - #[collect(require_static)] pub called_from: usize, - #[collect(require_static)] return_to: usize, - pub entity: Gc<'gc, RefLock>>, - pub locals: SymbolTable<'gc, C, S>, + #[collect(require_static)] called_from: usize, + #[collect(require_static)] return_to: usize, + entity: Gc<'gc, RefLock>>, + locals: SymbolTable<'gc, C, S>, #[collect(require_static)] warp_counter: usize, #[collect(require_static)] value_stack_size: usize, @@ -178,9 +177,12 @@ enum RequestAction { /// A collection of context info for starting a new [`Process`]. #[derive(Collect, Educe)] #[collect(no_drop, bound = "")] -#[educe(Clone, Default)] +#[educe(Clone)] pub struct ProcContext<'gc, C: CustomTypes, S: System> { + pub global_context: Gc<'gc, RefLock>>, + pub entity: Gc<'gc, RefLock>>, pub locals: SymbolTable<'gc, C, S>, + #[collect(require_static)] pub start_pos: usize, #[collect(require_static)] pub barrier: Option, #[collect(require_static)] pub reply_key: Option, #[collect(require_static)] pub local_message: Option, @@ -194,12 +196,12 @@ pub struct ProcContext<'gc, C: CustomTypes, S: System> { #[collect(no_drop, bound = "")] pub struct Process<'gc, C: CustomTypes, S: System> { global_context: Gc<'gc, RefLock>>, - #[collect(require_static)] start_pos: usize, #[collect(require_static)] pos: usize, #[collect(require_static)] running: bool, #[collect(require_static)] barrier: Option, #[collect(require_static)] reply_key: Option, #[collect(require_static)] warp_counter: usize, + #[collect(require_static)] state: C::ProcessState, call_stack: Vec>, value_stack: Vec>, #[collect(require_static)] handler_stack: Vec, @@ -212,23 +214,23 @@ pub struct Process<'gc, C: CustomTypes, S: System> { impl<'gc, C: CustomTypes, S: System> Process<'gc, C, S> { /// Creates a new [`Process`] that is tied to a given `start_pos` (entry point) in the [`ByteCode`] and associated with the specified `entity` and `system`. /// The created process is initialized to an idle (non-running) state; use [`Process::initialize`] to begin execution. - pub fn new(global_context: Gc<'gc, RefLock>>, entity: Gc<'gc, RefLock>>, start_pos: usize) -> Self { + pub fn new(context: ProcContext<'gc, C, S>) -> Self { Self { - global_context, - start_pos, - running: false, - barrier: None, - reply_key: None, - pos: 0, + global_context: context.global_context, + running: true, + barrier: context.barrier, + reply_key: context.reply_key, + pos: context.start_pos, warp_counter: 0, + state: C::ProcessState::from(&*context.entity.borrow()), call_stack: vec![CallStackEntry { called_from: usize::MAX, return_to: usize::MAX, warp_counter: 0, value_stack_size: 0, handler_stack_size: 0, - locals: Default::default(), - entity, + locals: context.locals, + entity: context.entity, }], value_stack: vec![], handler_stack: vec![], @@ -236,7 +238,7 @@ impl<'gc, C: CustomTypes, S: System> Process<'gc, C, S> { last_syscall_error: None, last_rpc_error: None, last_answer: None, - last_message: None, + last_message: context.local_message.map(|x| Rc::new(x).into()), } } /// Checks if the process is currently running. @@ -248,35 +250,6 @@ impl<'gc, C: CustomTypes, S: System> Process<'gc, C, S> { pub fn get_global_context(&self) -> Gc<'gc, RefLock>> { self.global_context } - /// Gets a reference to the current call stack. - /// This gives access to stack trace information including all local scopes in the call chain. - /// Note that the call stack is never empty, and that the always-present first element (denoting the initial execution request) is a special - /// entry which has an invalid value for [`CallStackEntry::called_from`], namely [`usize::MAX`]. - pub fn get_call_stack(&self) -> &[CallStackEntry<'gc, C, S>] { - &self.call_stack - } - /// Prepares the process to execute starting at the main entry point (see [`Process::new`]) with the provided input local variables. - /// A [`Barrier`] may also be set, which will be destroyed upon termination, either due to completion or an error. - /// - /// Any previous process state is wiped when performing this action. - pub fn initialize(&mut self, context: ProcContext<'gc, C, S>) { - self.pos = self.start_pos; - self.running = true; - self.barrier = context.barrier; - self.reply_key = context.reply_key; - self.warp_counter = 0; - self.call_stack.drain(1..); - self.call_stack[0].locals = context.locals; - self.value_stack.clear(); - self.handler_stack.clear(); - self.defer = None; - self.last_syscall_error = None; - self.last_rpc_error = None; - self.last_answer = None; - self.last_message = context.local_message.map(|x| Rc::new(x).into()); - - debug_assert_eq!(self.call_stack.len(), 1); - } /// Executes a single bytecode instruction. /// The return value can be used to determine what additional effects the script has requested, /// as well as to retrieve the return value or execution error in the event that the process terminates. @@ -487,7 +460,7 @@ impl<'gc, C: CustomTypes, S: System> Process<'gc, C, S> { self.value_stack.push(lookup_var!(var).get().clone()); self.pos = aft_pos; } - Instruction::PushEntity { name } => match global_context.entities.get(name) { + Instruction::PushEntity { name } => match global_context.entities.iter().find(|&x| x.borrow().name.as_str() == name) { Some(x) => { self.value_stack.push(Value::Entity(*x)); self.pos = aft_pos; @@ -1247,7 +1220,7 @@ impl<'gc, C: CustomTypes, S: System> Process<'gc, C, S> { costume: target.costume.clone(), state: C::EntityState::from(EntityKind::Clone { parent: &*target }), alive: true, - root: Some(target.root.unwrap_or(target_cell)), + original: Some(target.original.unwrap_or(target_cell)), fields: target.fields.clone(), })); self.value_stack.push(new_entity.into()); diff --git a/src/project.rs b/src/project.rs index ebacd07..53e80ce 100644 --- a/src/project.rs +++ b/src/project.rs @@ -317,8 +317,7 @@ impl<'gc, C: CustomTypes, S: System> Project<'gc, C, S> { ProjectStep::Pause } ProcessStep::Fork { pos, locals, entity } => { - let mut proc = Process::new(self.state.global_context, entity, pos); - proc.initialize(ProcContext { locals, barrier: None, reply_key: None, local_message: None }); + let mut proc = Process::new(ProcContext { global_context: self.state.global_context, entity, start_pos: pos, locals, barrier: None, reply_key: None, local_message: None }); let fork_proc_key = self.state.processes.insert(proc); all_contexts_consumer.do_once(self); // need to consume all contexts before scheduling things in the future @@ -327,10 +326,10 @@ impl<'gc, C: CustomTypes, S: System> Project<'gc, C, S> { ProjectStep::Normal } ProcessStep::CreatedClone { new_entity } => { - let root = new_entity.borrow().root.unwrap(); + let original = new_entity.borrow().original.unwrap(); let mut new_scripts = vec![]; for script in self.scripts.iter() { - if Gc::ptr_eq(script.entity, root) { + if Gc::ptr_eq(script.entity, original) { new_scripts.push(Script { event: script.event.clone(), entity: new_entity, diff --git a/src/runtime.rs b/src/runtime.rs index 20bba5a..fbb0006 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -1064,9 +1064,9 @@ impl<'gc, C: CustomTypes, S: System> Value<'gc, C, S> { #[derive(Collect)] #[collect(no_drop, bound = "")] pub struct Closure<'gc, C: CustomTypes, S: System> { - #[collect(require_static)] pub pos: usize, - #[collect(require_static)] pub params: Vec, - pub captures: SymbolTable<'gc, C, S>, + #[collect(require_static)] pub(crate) pos: usize, + #[collect(require_static)] pub(crate) params: Vec, + pub(crate) captures: SymbolTable<'gc, C, S>, } impl, S: System> fmt::Debug for Closure<'_, C, S> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1085,14 +1085,14 @@ pub enum EntityKind<'gc, 'a, C: CustomTypes, S: System> { #[derive(Collect)] #[collect(no_drop, bound = "")] pub struct Entity<'gc, C: CustomTypes, S: System> { - #[collect(require_static)] pub name: Rc, - #[collect(require_static)] pub sound_list: Rc)>>, - #[collect(require_static)] pub costume_list: Rc)>>, - #[collect(require_static)] pub costume: Option>, - #[collect(require_static)] pub state: C::EntityState, - #[collect(require_static)] pub alive: bool, - pub root: Option>>>, - pub fields: SymbolTable<'gc, C, S>, + #[collect(require_static)] pub(crate) name: Rc, + #[collect(require_static)] pub(crate) sound_list: Rc)>>, + #[collect(require_static)] pub(crate) costume_list: Rc)>>, + #[collect(require_static)] pub(crate) costume: Option>, + #[collect(require_static)] pub(crate) state: C::EntityState, + #[collect(require_static)] pub(crate) alive: bool, + pub(crate) original: Option>>>, + pub(crate) fields: SymbolTable<'gc, C, S>, } impl, S: System> fmt::Debug for Entity<'_, C, S> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1341,7 +1341,7 @@ pub struct GlobalContext<'gc, C: CustomTypes, S: System> { #[collect(require_static)] pub timer_start: u64, #[collect(require_static)] pub proj_name: String, pub globals: SymbolTable<'gc, C, S>, - pub entities: BTreeMap>>>, + pub entities: Vec>>>, } impl<'gc, C: CustomTypes, S: System> GlobalContext<'gc, C, S> { pub fn from_init(mc: &Mutation<'gc>, init_info: &InitInfo, bytecode: Rc, settings: Settings, system: Rc) -> Self { @@ -1381,7 +1381,7 @@ impl<'gc, C: CustomTypes, S: System> GlobalContext<'gc, C, S> { globals.define_or_redefine(global, Shared::Unique(get_value(value, &allocated_refs))); } - let mut entities = BTreeMap::new(); + let mut entities = Vec::with_capacity(init_info.entities.len()); for (i, entity_info) in init_info.entities.iter().enumerate() { let mut fields = SymbolTable::default(); for (field, value) in entity_info.fields.iter() { @@ -1431,7 +1431,7 @@ impl<'gc, C: CustomTypes, S: System> GlobalContext<'gc, C, S> { let name = Rc::new(entity_info.name.clone()); let state = kind.into(); - entities.insert(entity_info.name.clone(), Gc::new(mc, RefLock::new(Entity { alive: true, root: None, name, fields, sound_list, costume_list, costume, state }))); + entities.push(Gc::new(mc, RefLock::new(Entity { alive: true, original: None, name, fields, sound_list, costume_list, costume, state }))); } let proj_name = init_info.proj_name.clone(); @@ -1740,6 +1740,11 @@ pub trait CustomTypes>: 'static + Sized { /// This type should be constructable from [`EntityKind`], which is used to initialize a new entity in the runtime. type EntityState: 'static + for<'gc, 'a> From>; + /// Type used to represent a process's system-specific state. + /// This should include any details outside of core process functionality (e.g., external script-locals). + /// This type should be constructable from [`Entity`], which is used to initialize a new process in the runtime. + type ProcessState: 'static + for<'gc, 'a> From<&'a Entity<'gc, Self, S>>; + /// Converts a [`Value`] into a [`CustomTypes::Intermediate`] for use outside of gc context. fn from_intermediate<'gc>(mc: &Mutation<'gc>, value: Self::Intermediate) -> Result, ErrorCause>; } diff --git a/src/test/mod.rs b/src/test/mod.rs index d5e5895..de64b22 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -37,6 +37,13 @@ impl From>> for EntityState { } } +struct ProcessState; +impl From<&Entity<'_, C, StdSystem>> for ProcessState { + fn from(_: &Entity<'_, C, StdSystem>) -> Self { + ProcessState + } +} + fn default_properties_config() -> Config> { Config { request: Some(Rc::new(|_, _, key, request, entity| match request { @@ -61,6 +68,7 @@ impl CustomTypes> for C { type Intermediate = SimpleValue; type EntityState = EntityState; + type ProcessState = ProcessState; fn from_intermediate<'gc>(mc: &Mutation<'gc>, value: Self::Intermediate) -> Result>, ErrorCause>> { Ok(Value::from_simple(mc, value)) diff --git a/src/test/process.rs b/src/test/process.rs index adaf8ce..8d91c28 100644 --- a/src/test/process.rs +++ b/src/test/process.rs @@ -26,7 +26,7 @@ struct Env<'gc> { } type EnvArena = Arena]>; -fn get_running_proc<'a>(xml: &'a str, settings: Settings, system: Rc>) -> (EnvArena, Locations) { +fn get_running_proc<'a, F>(xml: &'a str, settings: Settings, system: Rc>, locals: F) -> (EnvArena, Locations) where F: for<'gc> Fn(&Mutation<'gc>) -> SymbolTable<'gc, C, StdSystem>{ let parser = ast::Parser::default(); let ast = parser.parse(xml).unwrap(); assert_eq!(ast.roles.len(), 1); @@ -36,12 +36,10 @@ fn get_running_proc<'a>(xml: &'a str, settings: Settings, system: Rc assert_eq!(&*x, ""), @@ -97,19 +95,17 @@ fn test_proc_ret() { #[test] fn test_proc_sum_123n() { let system = Rc::new(StdSystem::new_sync(BASE_URL.to_owned(), None, Config::default(), Arc::new(Clock::new(UtcOffset::UTC, None)))); - let (mut env, _) = get_running_proc(&format!(include_str!("templates/generic-static.xml"), - globals = "", - fields = "", - funcs = include_str!("blocks/sum-123n.xml"), - methods = "", - ), Settings::default(), system); for (n, expect) in [(0, json!("0")), (1, json!(1)), (2, json!(3)), (3, json!(6)), (4, json!(10)), (5, json!(15)), (6, json!(21))] { - env.mutate(|mc, env| { - let mut locals = SymbolTable::default(); - locals.define_or_redefine("n", Shared::Unique(Number::new(n as f64).unwrap().into())); - env.proc.borrow_mut(mc).initialize(ProcContext { locals, barrier: None, reply_key: None, local_message: None }); - }); + let mut locals = SymbolTable::default(); + locals.define_or_redefine("n", Shared::Unique(Number::new(n as f64).unwrap().into())); + + let (mut env, _) = get_running_proc(&format!(include_str!("templates/generic-static.xml"), + globals = "", + fields = "", + funcs = include_str!("blocks/sum-123n.xml"), + methods = "", + ), Settings::default(), system, |_| locals); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(expect).unwrap()); assert_values_eq(&res.unwrap().0.unwrap(), &expect, 1e-20, "sum 123n"); @@ -120,19 +116,17 @@ fn test_proc_sum_123n() { #[test] fn test_proc_recursive_factorial() { let system = Rc::new(StdSystem::new_sync(BASE_URL.to_owned(), None, Config::default(), Arc::new(Clock::new(UtcOffset::UTC, None)))); - let (mut env, _) = get_running_proc(&format!(include_str!("templates/generic-static.xml"), - globals = "", - fields = "", - funcs = include_str!("blocks/recursive-factorial.xml"), - methods = "", - ), Settings::default(), system); for (n, expect) in [(0, json!("1")), (1, json!("1")), (2, json!(2)), (3, json!(6)), (4, json!(24)), (5, json!(120)), (6, json!(720)), (7, json!(5040))] { - env.mutate(|mc, env| { - let mut locals = SymbolTable::default(); - locals.define_or_redefine("n", Shared::Unique(Number::new(n as f64).unwrap().into())); - env.proc.borrow_mut(mc).initialize(ProcContext { locals, barrier: None, reply_key: None, local_message: None }); - }); + let mut locals = SymbolTable::default(); + locals.define_or_redefine("n", Shared::Unique(Number::new(n as f64).unwrap().into())); + + let (mut env, _) = get_running_proc(&format!(include_str!("templates/generic-static.xml"), + globals = "", + fields = "", + funcs = include_str!("blocks/recursive-factorial.xml"), + methods = "", + ), Settings::default(), system, |_| locals); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(expect).unwrap()); assert_values_eq(&res.unwrap().0.unwrap(), &expect, 1e-20, "recursive factorial"); @@ -148,7 +142,7 @@ fn test_proc_loops_lists_basic() { fields = "", funcs = include_str!("blocks/loops-lists-basic.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expected = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -188,7 +182,7 @@ fn test_proc_recursively_self_containing_lists() { fields = "", funcs = include_str!("blocks/recursively-self-containing-lists.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| match res.unwrap().0.unwrap() { Value::List(res) => { @@ -228,22 +222,16 @@ fn test_proc_recursively_self_containing_lists() { #[test] fn test_proc_sieve_of_eratosthenes() { let system = Rc::new(StdSystem::new_sync(BASE_URL.to_owned(), None, Config::default(), Arc::new(Clock::new(UtcOffset::UTC, None)))); + + let mut locals = SymbolTable::default(); + locals.define_or_redefine("n", Shared::Unique(Number::new(100.0).unwrap().into())); + let (mut env, _) = get_running_proc(&format!(include_str!("templates/generic-static.xml"), globals = "", fields = "", funcs = include_str!("blocks/sieve-of-eratosthenes.xml"), methods = "", - ), Settings::default(), system); - - env.mutate(|mc, env| { - let mut locals = SymbolTable::default(); - locals.define_or_redefine("n", Shared::Unique(Number::new(100.0).unwrap().into())); - - let mut proc = env.proc.borrow_mut(mc); - assert!(proc.is_running()); - proc.initialize(ProcContext { locals, barrier: None, reply_key: None, local_message: None }); - assert!(proc.is_running()); - }); + ), Settings::default(), system, |_| locals); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97])).unwrap()); @@ -259,7 +247,7 @@ fn test_proc_early_return() { fields = "", funcs = include_str!("blocks/early-return.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([1,3])).unwrap()); @@ -275,7 +263,7 @@ fn test_proc_short_circuit() { fields = "", funcs = include_str!("blocks/short-circuit.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -303,7 +291,7 @@ fn test_proc_all_arithmetic() { fields = "", funcs = include_str!("blocks/all-arithmetic.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let inf = core::f64::INFINITY; @@ -347,7 +335,7 @@ fn test_proc_lambda_local_shadow_capture() { fields = "", funcs = include_str!("blocks/lambda-local-shadow-capture.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!(["1", "1", "1"])).unwrap()); @@ -363,7 +351,7 @@ fn test_proc_upvars() { fields = "", funcs = include_str!("blocks/upvars.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -422,7 +410,7 @@ fn test_proc_generators_nested() { fields = "", funcs = include_str!("blocks/generators-nested.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([1, 25, 169, 625, 1681, 3721, 7225, 12769, 21025, 32761])).unwrap()); @@ -438,7 +426,7 @@ fn test_proc_call_in_closure() { fields = "", funcs = include_str!("blocks/call-in-closure.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -452,19 +440,17 @@ fn test_proc_call_in_closure() { #[test] fn test_proc_warp_yields() { let system = Rc::new(StdSystem::new_sync(BASE_URL.to_owned(), None, Config::default(), Arc::new(Clock::new(UtcOffset::UTC, None)))); - let (mut env, _) = get_running_proc(&format!(include_str!("templates/generic-static.xml"), - globals = r#"0"#, - fields = "", - funcs = include_str!("blocks/warp-yields.xml"), - methods = "", - ), Settings::default(), system); for (mode, (expected_counter, expected_yields)) in [(12, 12), (13, 13), (17, 0), (18, 0), (16, 0), (17, 2), (14, 0), (27, 3), (30, 7), (131, 109), (68, 23), (51, 0), (63, 14)].into_iter().enumerate() { - env.mutate(|mc, env| { - let mut locals = SymbolTable::default(); - locals.define_or_redefine("mode", Shared::Unique(Number::new(mode as f64).unwrap().into())); - env.proc.borrow_mut(mc).initialize(ProcContext { locals, barrier: None, reply_key: None, local_message: None }); - }); + let mut locals = SymbolTable::default(); + locals.define_or_redefine("mode", Shared::Unique(Number::new(mode as f64).unwrap().into())); + + let (mut env, _) = get_running_proc(&format!(include_str!("templates/generic-static.xml"), + globals = r#"0"#, + fields = "", + funcs = include_str!("blocks/warp-yields.xml"), + methods = "", + ), Settings::default(), system, |_| locals); run_till_term(&mut env, |mc, env, res| { let (res, yields) = res.unwrap(); @@ -484,7 +470,7 @@ fn test_proc_string_ops() { fields = "", funcs = include_str!("blocks/string-ops.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -545,7 +531,7 @@ fn test_proc_str_cmp_case_insensitive() { fields = "", funcs = include_str!("blocks/str-cmp-case-insensitive.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -562,20 +548,18 @@ fn test_proc_str_cmp_case_insensitive() { #[test] fn test_proc_rpc_call_basic() { let system = Rc::new(StdSystem::new_sync(BASE_URL.to_owned(), None, Config::default(), Arc::new(Clock::new(UtcOffset::UTC, None)))); - let (mut env, _) = get_running_proc(&format!(include_str!("templates/generic-static.xml"), - globals = "", - fields = "", - funcs = include_str!("blocks/rpc-call-basic.xml"), - methods = "", - ), Settings::default(), system); for (lat, long, city) in [(36.1627, -86.7816, "Nashville"), (40.8136, -96.7026, "Lincoln"), (40.7608, -111.8910, "Salt Lake City")] { - env.mutate(|mc, env| { - let mut locals = SymbolTable::default(); - locals.define_or_redefine("lat", Shared::Unique(Number::new(lat).unwrap().into())); - locals.define_or_redefine("long", Shared::Unique(Number::new(long).unwrap().into())); - env.proc.borrow_mut(mc).initialize(ProcContext { locals, barrier: None, reply_key: None, local_message: None }); - }); + let mut locals = SymbolTable::default(); + locals.define_or_redefine("lat", Shared::Unique(Number::new(lat).unwrap().into())); + locals.define_or_redefine("long", Shared::Unique(Number::new(long).unwrap().into())); + + let (mut env, _) = get_running_proc(&format!(include_str!("templates/generic-static.xml"), + globals = "", + fields = "", + funcs = include_str!("blocks/rpc-call-basic.xml"), + methods = "", + ), Settings::default(), system, |_| locals); run_till_term(&mut env, |_, _, res| match res.unwrap().0.unwrap() { Value::String(ret) => assert_eq!(&*ret, city), x => panic!("{:?}", x), @@ -591,7 +575,7 @@ fn test_proc_list_index_blocks() { fields = "", funcs = include_str!("blocks/list-index-blocks.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -624,7 +608,7 @@ fn test_proc_literal_types() { fields = "", funcs = include_str!("blocks/literal-types.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ "50e4", "50e4s" ])).unwrap()); @@ -653,7 +637,7 @@ fn test_proc_say() { fields = "", funcs = include_str!("blocks/say.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |_, _, _| ()); assert_eq!(output.borrow().as_str(), "\"Greetings, human.\"\n\"I will destroy him.\"\n"); @@ -697,7 +681,7 @@ fn test_proc_syscall() { fields = "", funcs = include_str!("blocks/syscall.xml"), methods = "", - ), Settings { syscall_error_scheme: ErrorScheme::Soft, ..Default::default() }, system); + ), Settings { syscall_error_scheme: ErrorScheme::Soft, ..Default::default() }, system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -719,7 +703,7 @@ fn test_proc_timer_wait() { fields = "", funcs = include_str!("blocks/timer-wait.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); let start = std::time::Instant::now(); run_till_term(&mut env, |mc, _, res| { @@ -738,7 +722,7 @@ fn test_proc_cons_cdr() { fields = "", funcs = include_str!("blocks/cons-cdr.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -765,7 +749,7 @@ fn test_proc_list_find_contains() { fields = "", funcs = include_str!("blocks/list-find-contains.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -793,7 +777,7 @@ fn test_proc_append() { fields = "", funcs = include_str!("blocks/append.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -816,7 +800,7 @@ fn test_proc_foreach_mutate() { fields = "", funcs = include_str!("blocks/foreach-mutate.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -836,7 +820,7 @@ fn test_proc_map() { fields = "", funcs = include_str!("blocks/map.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -856,7 +840,7 @@ fn test_proc_keep_find() { fields = "", funcs = include_str!("blocks/keep-find.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -878,7 +862,7 @@ fn test_proc_numeric_bases() { fields = "", funcs = include_str!("blocks/numeric-bases.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -900,7 +884,7 @@ fn test_proc_combine() { fields = "", funcs = include_str!("blocks/combine.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -927,7 +911,7 @@ fn test_proc_autofill_closure_params() { fields = "", funcs = include_str!("blocks/autofill-closure-params.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -949,7 +933,7 @@ fn test_proc_pick_random() { fields = "", funcs = include_str!("blocks/pick-random.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |_, _, res| { let results = { @@ -1010,7 +994,7 @@ fn test_proc_rand_list_ops() { fields = "", funcs = include_str!("blocks/rand-list-ops.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |_, _, res| { let (results, last) = { @@ -1064,7 +1048,7 @@ fn test_proc_variadic_sum_product() { fields = "", funcs = include_str!("blocks/variadic-sum-product.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1091,7 +1075,7 @@ fn test_proc_variadic_min_max() { fields = "", funcs = include_str!("blocks/variadic-min-max.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ "1", "2", "9", "17" ])).unwrap()); @@ -1107,7 +1091,7 @@ fn test_proc_atan2_new_cmp() { fields = "", funcs = include_str!("blocks/atan2-new-cmp.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1132,7 +1116,7 @@ fn test_proc_list_columns() { fields = "", funcs = include_str!("blocks/list-columns.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1176,7 +1160,7 @@ fn test_proc_transpose_consistency() { fields = "", funcs = include_str!("blocks/transpose-consistency.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1202,7 +1186,7 @@ fn test_proc_compare_str() { fields = "", funcs = include_str!("blocks/compare-str.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1271,7 +1255,7 @@ fn test_proc_new_min_max() { fields = "", funcs = include_str!("blocks/new-min-max.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1300,7 +1284,7 @@ fn test_proc_flatten() { fields = "", funcs = include_str!("blocks/flatten.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1321,7 +1305,7 @@ fn test_proc_list_len_rank_dims() { fields = "", funcs = include_str!("blocks/list-len-rank-dims.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1347,7 +1331,7 @@ fn test_proc_string_index() { fields = "", funcs = include_str!("blocks/string-index.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1370,7 +1354,7 @@ fn test_proc_type_query() { fields = "", funcs = include_str!("blocks/type-query.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1399,7 +1383,7 @@ fn test_proc_variadic_strcat() { fields = "", funcs = include_str!("blocks/variadic-strcat.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1420,7 +1404,7 @@ fn test_proc_list_lines() { fields = "", funcs = include_str!("blocks/list-lines.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1441,7 +1425,7 @@ fn test_proc_whitespace_in_numbers() { fields = "", funcs = include_str!("blocks/whitespace-in-numbers.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1466,7 +1450,7 @@ fn test_proc_binary_make_range() { fields = "", funcs = include_str!("blocks/binary-make-range.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1501,7 +1485,7 @@ fn test_proc_identical_to() { fields = "", funcs = include_str!("blocks/identical-to.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1522,7 +1506,7 @@ fn test_proc_variadic_list_ctors() { fields = "", funcs = include_str!("blocks/variadic-list-ctors.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1550,7 +1534,7 @@ fn test_proc_list_rev() { fields = "", funcs = include_str!("blocks/list-rev.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1570,7 +1554,7 @@ fn test_proc_list_reshape() { fields = "", funcs = include_str!("blocks/list-reshape.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1606,7 +1590,7 @@ fn test_proc_list_json() { fields = "", funcs = include_str!("blocks/list-json.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1629,7 +1613,7 @@ fn test_proc_explicit_to_string_cvt() { fields = "", funcs = include_str!("blocks/explicit-to-string-cvt.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1655,7 +1639,7 @@ fn test_proc_empty_variadic_no_auto_insert() { fields = "", funcs = include_str!("blocks/empty-variadic-no-auto-insert.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1677,7 +1661,7 @@ fn test_proc_c_ring_no_auto_insert() { fields = "", funcs = include_str!("blocks/c-ring-no-auto-insert.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1699,7 +1683,7 @@ fn test_proc_signed_zero() { fields = "", funcs = include_str!("blocks/signed-zero.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1724,7 +1708,7 @@ fn test_proc_singleton_sum_product() { fields = "", funcs = include_str!("blocks/singleton-sum-product.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1743,7 +1727,7 @@ fn test_proc_list_combinations() { fields = "", funcs = include_str!("blocks/list-combinations.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1787,7 +1771,7 @@ fn test_proc_unevaluated_inputs() { fields = "", funcs = include_str!("blocks/unevaluated-inputs.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1805,7 +1789,7 @@ fn test_proc_index_over_bounds() { fields = "", funcs = include_str!("blocks/index-over-bounds.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |_, _, res| { let res = res.unwrap_err(); @@ -1828,7 +1812,7 @@ fn test_proc_neg_collab_ids() { fields = "", funcs = include_str!("blocks/neg-collab-ids.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |_, _, res| { let res = res.unwrap_err(); @@ -1902,7 +1886,7 @@ fn test_proc_basic_motion() { fields = "", funcs = include_str!("blocks/basic-motion.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expected = Value::from_simple(mc, SimpleValue::from_json(json!([ 13, 54, 39 ])).unwrap()); @@ -1931,7 +1915,7 @@ fn test_proc_string_cmp() { fields = "", funcs = include_str!("blocks/string-cmp.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -1952,7 +1936,7 @@ fn test_proc_stack_overflow() { fields = r#"0"#, funcs = "", methods = include_str!("blocks/stack-overflow.xml"), - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |_, env, res| { let err = res.unwrap_err(); @@ -1991,7 +1975,7 @@ fn test_proc_variadic_params() { fields = "", funcs = include_str!("blocks/variadic-params.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -2022,7 +2006,7 @@ fn test_proc_rand_str_char_cache() { fields = "", funcs = include_str!("blocks/rand-str-char-cache.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |_, _, res| { let res = res.unwrap().0.unwrap().as_string().unwrap().into_owned(); @@ -2049,7 +2033,7 @@ fn test_proc_noop_upvars() { fields = "", funcs = include_str!("blocks/noop-upvars.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ 0, 0, 1, 0 ])).unwrap()); @@ -2065,7 +2049,7 @@ fn test_proc_try_catch_throw() { fields = "", funcs = include_str!("blocks/try-catch-throw.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ "starting", "start code", "got error", "test error", "done" ])).unwrap()); @@ -2081,7 +2065,7 @@ fn test_proc_exception_unregister() { fields = "", funcs = include_str!("blocks/exception-unregister.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ "top start", "before test", "before inner", "inner error", "IndexOutOfBounds { index: 332534, len: 3 }", "after test", "top error", "IndexOutOfBounds { index: 332534, len: 6 }", "top done"])).unwrap()); @@ -2097,7 +2081,7 @@ fn test_proc_exception_rethrow() { fields = "", funcs = include_str!("blocks/exception-rethrow.xml"), methods = "", - ), Settings::default(), system); + ), Settings::default(), system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ "IndexOutOfBounds { index: 543548, len: 0 }", "test error here" ])).unwrap()); @@ -2113,7 +2097,7 @@ fn test_proc_rpc_error() { fields = "", funcs = include_str!("blocks/rpc-error.xml"), methods = "", - ), Settings { rpc_error_scheme: ErrorScheme::Soft, ..Default::default() }, system); + ), Settings { rpc_error_scheme: ErrorScheme::Soft, ..Default::default() }, system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -2135,7 +2119,7 @@ fn test_proc_c_rings() { fields = "", funcs = include_str!("blocks/c-rings.xml"), methods = "", - ), Settings { rpc_error_scheme: ErrorScheme::Soft, ..Default::default() }, system); + ), Settings { rpc_error_scheme: ErrorScheme::Soft, ..Default::default() }, system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -2159,7 +2143,7 @@ fn test_proc_wall_time() { fields = "", funcs = include_str!("blocks/wall-time.xml"), methods = "", - ), Settings { rpc_error_scheme: ErrorScheme::Soft, ..Default::default() }, system); + ), Settings { rpc_error_scheme: ErrorScheme::Soft, ..Default::default() }, system, |_| SymbolTable::default()); run_till_term(&mut env, |_, _, res| { let t = OffsetDateTime::now_utc().to_offset(utc_offset); @@ -2186,7 +2170,7 @@ fn test_proc_to_csv() { fields = "", funcs = include_str!("blocks/to-csv.xml"), methods = "", - ), Settings { rpc_error_scheme: ErrorScheme::Soft, ..Default::default() }, system); + ), Settings { rpc_error_scheme: ErrorScheme::Soft, ..Default::default() }, system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -2212,7 +2196,7 @@ fn test_proc_from_csv() { fields = "", funcs = include_str!("blocks/from-csv.xml"), methods = "", - ), Settings { rpc_error_scheme: ErrorScheme::Soft, ..Default::default() }, system); + ), Settings { rpc_error_scheme: ErrorScheme::Soft, ..Default::default() }, system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -2246,7 +2230,7 @@ fn test_proc_extra_cmp_tests() { fields = "", funcs = include_str!("blocks/extra-cmp-tests.xml"), methods = "", - ), Settings { rpc_error_scheme: ErrorScheme::Soft, ..Default::default() }, system); + ), Settings { rpc_error_scheme: ErrorScheme::Soft, ..Default::default() }, system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!([ @@ -2339,7 +2323,7 @@ fn test_proc_extra_blocks() { fields = "", funcs = include_str!("blocks/extra-blocks.xml"), methods = "", - ), Settings { rpc_error_scheme: ErrorScheme::Soft, ..Default::default() }, system); + ), Settings { rpc_error_scheme: ErrorScheme::Soft, ..Default::default() }, system, |_| SymbolTable::default()); run_till_term(&mut env, |mc, _, res| { let expect = Value::from_simple(mc, SimpleValue::from_json(json!("cool")).unwrap());