From 7db2cdbe2399d3a86e0b19f7335a1b6aaf351ab5 Mon Sep 17 00:00:00 2001 From: Victor Adossi Date: Fri, 14 Nov 2025 01:21:46 +0900 Subject: [PATCH] fix(core): async import emission This commit fixes async import emissions in the case of lowered args and lifted resutls. There were a few bugs to fix: - AsyncTaskReturn was not being emitted - Implementation for async imports was not present --- crates/core/src/abi.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/crates/core/src/abi.rs b/crates/core/src/abi.rs index b1075d0f2..72c05ffb2 100644 --- a/crates/core/src/abi.rs +++ b/crates/core/src/abi.rs @@ -1100,10 +1100,21 @@ impl<'a, B: Bindgen> Generator<'a, B> { } // Emit the function return - self.emit(&Instruction::Return { - func, - amt: usize::from(func.result.is_some()), - }); + if async_ { + self.emit(&Instruction::AsyncTaskReturn { + name: &func.name, + params: if func.result.is_some() { + &[WasmType::Pointer] + } else { + &[] + }, + }); + } else { + self.emit(&Instruction::Return { + func, + amt: usize::from(func.result.is_some()), + }); + } } LiftLower::LiftArgsLowerResults => {