Skip to content

Commit 23c974e

Browse files
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
1 parent e14b18c commit 23c974e

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
@@ -1099,10 +1099,21 @@ impl<'a, B: Bindgen> Generator<'a, B> {
10991099
}
11001100

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

11081119
LiftLower::LiftArgsLowerResults => {

0 commit comments

Comments
 (0)