From f9c1d6e5c942ac28e3613710f60176510abca4bf Mon Sep 17 00:00:00 2001 From: Philippe Laferriere Date: Tue, 11 Jun 2024 16:54:21 -0400 Subject: [PATCH] Remove `Assembler::assemble_test()` --- assembly/src/assembler/mod.rs | 19 ------------------- assembly/src/assembler/tests.rs | 4 ++-- assembly/src/testing.rs | 3 ++- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/assembly/src/assembler/mod.rs b/assembly/src/assembler/mod.rs index 5deff97767..0d3cac2590 100644 --- a/assembly/src/assembler/mod.rs +++ b/assembly/src/assembler/mod.rs @@ -322,25 +322,6 @@ impl Assembler { self.assemble_in_context(source, &mut context) } - /// Compiles the provided source into a [`MastForest`], without consuming the assembler. - /// - /// Note that the state of any kernel used upon initialization will be wiped, so this function - /// should not be used to assemble multiple modules successively. Its main purpose is to allow - /// the caller to access the internal procedure cache and/or module graph after a single call to - /// `assemble_test`. - #[cfg(any(test, feature = "testing"))] - #[doc(hidden)] - pub fn assemble_test(&mut self, source: impl Compile) -> Result { - let mut context = AssemblyContext::default(); - context.set_warnings_as_errors(self.warnings_as_errors); - let opts = CompileOptions { - warnings_as_errors: context.warnings_as_errors(), - ..CompileOptions::default() - }; - - self.assemble_with_options_in_context_impl(source, opts, &mut context) - } - /// Like [Assembler::compile], but also takes an [AssemblyContext] to configure the assembler. pub fn assemble_in_context( self, diff --git a/assembly/src/assembler/tests.rs b/assembly/src/assembler/tests.rs index 3140363a18..75ad0ed2e7 100644 --- a/assembly/src/assembler/tests.rs +++ b/assembly/src/assembler/tests.rs @@ -62,7 +62,7 @@ fn nested_blocks() { } } - let mut assembler = Assembler::with_kernel_from_module(KERNEL) + let assembler = Assembler::with_kernel_from_module(KERNEL) .unwrap() .with_library(&DummyLibrary::default()) .unwrap(); @@ -119,7 +119,7 @@ fn nested_blocks() { syscall.foo end"#; - let program = assembler.assemble_test(program).unwrap(); + let program = assembler.assemble(program).unwrap(); let exec_bar_node_id = { // bar procedure diff --git a/assembly/src/testing.rs b/assembly/src/testing.rs index e1e34d1a64..b622aa4e35 100644 --- a/assembly/src/testing.rs +++ b/assembly/src/testing.rs @@ -309,7 +309,8 @@ impl TestContext { #[track_caller] pub fn assemble(&mut self, source: impl Compile) -> Result { self.assembler - .assemble_test(source) + .clone() + .assemble(source) .map(|mast_forest| mast_forest.try_into().unwrap()) }