Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
d0cd committed Oct 27, 2023
1 parent 8f78d08 commit dc4668b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions compiler/passes/src/code_generation/visit_program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ impl<'a> CodeGenerator<'a> {
// If the function contained calls that produced futures, then we need to add the futures to the finalize block as input.
// Store the new future registers.
let mut future_registers = Vec::new();
for (_, future_type) in &self.futures {
for (_, future_type) in self.futures.drain(..) {
let register_string = format!("r{}", self.next_register);
writeln!(function_string, " input {register_string} as {future_type}.future;")
.expect("failed to write to string");
Expand Down Expand Up @@ -266,9 +266,6 @@ impl<'a> CodeGenerator<'a> {
writeln!(function_string, " await {register};").expect("failed to write to string");
}

// Clear the futures.
self.futures.clear();

// Construct and append the finalize block body, if it exists.
if let Some(finalize) = &function.finalize {
function_string.push_str(&self.visit_block(&finalize.block));
Expand Down

0 comments on commit dc4668b

Please sign in to comment.