diff --git a/src/protocol/ast.rs b/src/protocol/ast.rs index c9a3b7df8f7d7f790269307323008e0849b06bf0..468330bceee9955aaa86445979d345f962df61e9 100644 --- a/src/protocol/ast.rs +++ b/src/protocol/ast.rs @@ -123,7 +123,7 @@ define_new_ast_id!(FunctionDefinitionId, DefinitionId, index(FunctionDefinition, define_aliased_ast_id!(StatementId, Id, index(Statement, statements)); define_new_ast_id!(BlockStatementId, StatementId, index(BlockStatement, Statement::Block, statements), alloc(alloc_block_statement)); define_new_ast_id!(EndBlockStatementId, StatementId, index(EndBlockStatement, Statement::EndBlock, statements), alloc(alloc_end_block_statement)); -define_new_ast_id!(LocalStatementId, StatementId, index(LocalStatement, Statement::Local, statements), alloc(alloc_local_statement)); +define_new_ast_id!(LocalStatementId, StatementId, index(LocalStatement, Statement::Local, statements)); define_new_ast_id!(MemoryStatementId, LocalStatementId); define_new_ast_id!(ChannelStatementId, LocalStatementId); define_new_ast_id!(LabeledStatementId, StatementId, index(LabeledStatement, Statement::Labeled, statements), alloc(alloc_labeled_statement)); diff --git a/src/protocol/tests/utils.rs b/src/protocol/tests/utils.rs index 6407afea6458747e10b2a7e6e534aee15e3aa619..e21d72b5708c0631c39008fffe5427d0880a83da 100644 --- a/src/protocol/tests/utils.rs +++ b/src/protocol/tests/utils.rs @@ -1,16 +1,10 @@ use crate::collections::StringPool; -use crate::protocol::{ - Module, - ast::*, - input_source::*, - parser::{ - Parser, - type_table::*, - symbol_table::SymbolTable, - token_parsing::*, - }, - eval::*, -}; +use crate::protocol::{Module, ast::*, input_source::*, parser::{ + Parser, + type_table::*, + symbol_table::SymbolTable, + token_parsing::*, +}, eval::*, RunContext}; // Carries information about the test into utility structures for builder-like // assertions @@ -691,7 +685,7 @@ impl<'a> FunctionTester<'a> { use crate::protocol::*; let mut prompt = Prompt::new(&self.ctx.types, &self.ctx.heap, self.def.this.upcast(), 0, ValueGroup::new_stack(Vec::new())); - let mut call_context = EvalContext::None; + let mut call_context = FakeRunContext{}; loop { let result = prompt.step(&self.ctx.types, &self.ctx.heap, &self.ctx.modules, &mut call_context); match result { @@ -1280,4 +1274,27 @@ fn seek_expr_in_stmt bool>(heap: &Heap, start: StatementId }, _ => None } +} + +struct FakeRunContext{} +impl RunContext for FakeRunContext { + fn performed_put(&mut self, _port: PortId) -> bool { + unreachable!("'put' called in compiler testing code") + } + + fn performed_get(&mut self, _port: PortId) -> Option { + unreachable!("'get' called in compiler testing code") + } + + fn fires(&mut self, _port: PortId) -> Option { + unreachable!("'fires' called in compiler testing code") + } + + fn performed_fork(&mut self) -> Option { + unreachable!("'fork' called in compiler testing code") + } + + fn created_channel(&mut self) -> Option<(Value, Value)> { + unreachable!("channel created in compiler testing code") + } } \ No newline at end of file diff --git a/src/runtime/tests/data_transmission.rs b/src/runtime/tests/data_transmission.rs index 1320e4f6b2f6721a39ce094a7c0e5c6390ed49f7..f93df6d9f1d5078fa4bca7c25711a4845bdaafc0 100644 --- a/src/runtime/tests/data_transmission.rs +++ b/src/runtime/tests/data_transmission.rs @@ -55,12 +55,12 @@ fn test_single_put_and_get() { let channel = api.create_channel().unwrap(); api.create_connector("", "putter", ValueGroup::new_stack(vec![ - Value::Output(PortId(Id{ connector_id: 0, u32_suffix: channel.putter_id.index })), + Value::Output(PortId::new(channel.putter_id.index)), Value::UInt32(NUM_LOOPS) ])).expect("create putter"); api.create_connector("", "getter", ValueGroup::new_stack(vec![ - Value::Input(PortId(Id{ connector_id: 0, u32_suffix: channel.getter_id.index })), + Value::Input(PortId::new(channel.getter_id.index)), Value::UInt32(NUM_LOOPS) ])).expect("create getter"); }); diff --git a/src/runtime/tests/mod.rs b/src/runtime/tests/mod.rs index 3fdcdf9cdedf9f36b072a9185f65eb55e01181cd..d0ded00698b65b38c804a03c66b5cf8e649d8a67 100644 --- a/src/runtime/tests/mod.rs +++ b/src/runtime/tests/mod.rs @@ -5,8 +5,7 @@ mod data_transmission; mod sync_failure; use super::*; -use crate::{PortId, ProtocolDescription}; -use crate::common::Id; +use crate::ProtocolDescription; use crate::protocol::eval::*; use crate::runtime::native::{ApplicationSyncAction};