From fad5d4a450851b9417c92cc55c60a0f6e1dec9f0 Mon Sep 17 00:00:00 2001 From: "Stefan J. Wernli" Date: Wed, 11 Dec 2024 13:51:59 -0800 Subject: [PATCH] Move `invoke` up so it's next to `eval_fragments` --- compiler/qsc/src/interpret.rs | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/compiler/qsc/src/interpret.rs b/compiler/qsc/src/interpret.rs index 9618c29a16..5063b69871 100644 --- a/compiler/qsc/src/interpret.rs +++ b/compiler/qsc/src/interpret.rs @@ -536,21 +536,6 @@ impl Interpreter { ) } - /// Runs the given entry expression on a new instance of the environment and simulator, - /// but using the current compilation. - pub fn run( - &mut self, - receiver: &mut impl Receiver, - expr: Option<&str>, - noise: Option, - ) -> InterpretResult { - let mut sim = match noise { - Some(noise) => SparseSim::new_with_noise(&noise), - None => SparseSim::new(), - }; - self.run_with_sim(&mut sim, receiver, expr) - } - /// Invokes the given callable with the given arguments using the current environment, simlator, and compilation. pub fn invoke( &mut self, @@ -577,6 +562,22 @@ impl Interpreter { ) }) } + + /// Runs the given entry expression on a new instance of the environment and simulator, + /// but using the current compilation. + pub fn run( + &mut self, + receiver: &mut impl Receiver, + expr: Option<&str>, + noise: Option, + ) -> InterpretResult { + let mut sim = match noise { + Some(noise) => SparseSim::new_with_noise(&noise), + None => SparseSim::new(), + }; + self.run_with_sim(&mut sim, receiver, expr) + } + /// Gets the current quantum state of the simulator. pub fn get_quantum_state(&mut self) -> (Vec<(BigUint, Complex)>, usize) { self.sim.capture_quantum_state()