cranelift-frontend: make FunctionBuilder::finalize consume self (#5316)

This commit is contained in:
Rodrigo Batista de Moraes
2022-11-23 20:41:52 -03:00
committed by GitHub
parent 044b57f334
commit 28cf995fd3
3 changed files with 29 additions and 31 deletions

View File

@@ -596,10 +596,11 @@ impl<'a> FunctionBuilder<'a> {
}
}
/// Declare that translation of the current function is complete. This
/// resets the state of the `FunctionBuilder` in preparation to be used
/// for another function.
pub fn finalize(&mut self) {
/// Declare that translation of the current function is complete.
///
/// This resets the state of the `FunctionBuilderContext` in preparation to
/// be used for another function.
pub fn finalize(self) {
// Check that all the `Block`s are filled and sealed.
#[cfg(debug_assertions)]
{
@@ -637,10 +638,6 @@ impl<'a> FunctionBuilder<'a> {
// Clear the state (but preserve the allocated buffers) in preparation
// for translation another function.
self.func_ctx.clear();
// Reset srcloc and position to initial states.
self.srcloc = Default::default();
self.position = Default::default();
}
}