From e34caf1458007072b7296d12ebb51e4178965054 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Wed, 18 Oct 2023 09:55:24 -0400 Subject: [PATCH] Implement fix --- compiler/passes/src/code_generation/visit_expressions.rs | 7 ++++++- compiler/passes/src/code_generation/visit_statements.rs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/passes/src/code_generation/visit_expressions.rs b/compiler/passes/src/code_generation/visit_expressions.rs index c3d6900da9..049ff2eca0 100644 --- a/compiler/passes/src/code_generation/visit_expressions.rs +++ b/compiler/passes/src/code_generation/visit_expressions.rs @@ -551,7 +551,12 @@ impl<'a> CodeGenerator<'a> { Some(Expression::Identifier(identifier)) => identifier, _ => unreachable!("If `has_finalize` is true, then the external call must be an identifier."), }; - self.futures.push((future_register, format!("{program_id}/{function_name}"))); + + // Add the futures register to the list of futures. + self.futures.push((future_register.clone(), format!("{program_id}/{function_name}"))); + + // Add the future register to the list of destinations. + destinations.push(future_register); } // If destination registers were created, write them to the call instruction. diff --git a/compiler/passes/src/code_generation/visit_statements.rs b/compiler/passes/src/code_generation/visit_statements.rs index 3d6f0c88c9..3ba83e29bc 100644 --- a/compiler/passes/src/code_generation/visit_statements.rs +++ b/compiler/passes/src/code_generation/visit_statements.rs @@ -167,7 +167,7 @@ impl<'a> CodeGenerator<'a> { } // Write the destination register. let destination_register = format!("r{}", self.next_register); - write!(async_instruction, " into {};", destination_register).expect("failed to write to string"); + write!(async_instruction, " into {};\n", destination_register).expect("failed to write to string"); // Increment the register counter. self.next_register += 1; // Add the async instruction to the instructions.