Skip to content

Commit 10291cd

Browse files
fix(core): async import emission (#1455)
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
1 parent 822fdb1 commit 10291cd

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

crates/core/src/abi.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,10 +1100,21 @@ impl<'a, B: Bindgen> Generator<'a, B> {
11001100
}
11011101

11021102
// Emit the function return
1103-
self.emit(&Instruction::Return {
1104-
func,
1105-
amt: usize::from(func.result.is_some()),
1106-
});
1103+
if async_ {
1104+
self.emit(&Instruction::AsyncTaskReturn {
1105+
name: &func.name,
1106+
params: if func.result.is_some() {
1107+
&[WasmType::Pointer]
1108+
} else {
1109+
&[]
1110+
},
1111+
});
1112+
} else {
1113+
self.emit(&Instruction::Return {
1114+
func,
1115+
amt: usize::from(func.result.is_some()),
1116+
});
1117+
}
11071118
}
11081119

11091120
LiftLower::LiftArgsLowerResults => {

0 commit comments

Comments
 (0)