Replace single use of Frame::with_parameters with Frame::set_all

This commit is contained in:
Andrew Brown
2020-05-25 20:25:43 -07:00
committed by Benjamin Bouvier
parent d73cb48c29
commit 6e7276e48d
2 changed files with 2 additions and 11 deletions

View File

@@ -30,16 +30,6 @@ impl<'a> Frame<'a> {
} }
} }
/// Construct a new [Frame] with the given `values` assigned to their corresponding slot
/// (from the SSA references in `parameters`) in the [Frame].
pub fn with_parameters(mut self, parameters: &[ValueRef], values: &[DataValue]) -> Self {
assert_eq!(parameters.len(), values.len());
for (n, v) in parameters.iter().zip(values) {
self.registers.insert(*n, v.clone());
}
self
}
/// Retrieve the actual value associated with an SSA reference. /// Retrieve the actual value associated with an SSA reference.
#[inline] #[inline]
pub fn get(&self, name: &ValueRef) -> &DataValue { pub fn get(&self, name: &ValueRef) -> &DataValue {

View File

@@ -112,7 +112,8 @@ impl Interpreter {
.next() .next()
.expect("to have a first block"); .expect("to have a first block");
let parameters = function.dfg.block_params(first_block); let parameters = function.dfg.block_params(first_block);
let mut frame = Frame::new(function).with_parameters(parameters, arguments); let mut frame = Frame::new(function);
frame.set_all(parameters, arguments.to_vec());
self.block(&mut frame, first_block) self.block(&mut frame, first_block)
} }