Skip to content

Commit

Permalink
misc(moonbit): add canon for list<f32>
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-jerry-ye committed Dec 4, 2024
1 parent fb50f38 commit f63fa19
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/moonbit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,7 @@ impl InterfaceGenerator<'_> {
| Type::U64
| Type::S32
| Type::S64
| Type::F32
| Type::F64 => {
format!("FixedArray[{}]", self.type_name(ty, type_variable))
}
Expand Down Expand Up @@ -2145,14 +2146,15 @@ impl Bindgen for FunctionBindgen<'_, '_> {
self.cleanup.push(Cleanup::Object(op.clone()));
}
}
Type::U32 | Type::U64 | Type::S32 | Type::S64 | Type::F64 => {
Type::U32 | Type::U64 | Type::S32 | Type::S64 | Type::F32 | Type::F64 => {
let op = &operands[0];

let ty = match element {
Type::U32 => "uint",
Type::U64 => "uint64",
Type::S32 => "int",
Type::S64 => "int64",
Type::F32 => "float",
Type::F64 => "double",
_ => unreachable!(),
};
Expand Down Expand Up @@ -2186,12 +2188,13 @@ impl Bindgen for FunctionBindgen<'_, '_> {

results.push(result);
}
Type::U32 | Type::U64 | Type::S32 | Type::S64 | Type::F64 => {
Type::U32 | Type::U64 | Type::S32 | Type::S64 | Type::F32 | Type::F64 => {
let ty = match element {
Type::U32 => "uint",
Type::U64 => "uint64",
Type::S32 => "int",
Type::S64 => "int64",
Type::F32 => "float",
Type::F64 => "double",
_ => unreachable!(),
};
Expand Down Expand Up @@ -2725,7 +2728,7 @@ impl Bindgen for FunctionBindgen<'_, '_> {
fn is_list_canonical(&self, _resolve: &Resolve, element: &Type) -> bool {
matches!(
element,
Type::U8 | Type::U32 | Type::U64 | Type::S32 | Type::S64 | Type::F64
Type::U8 | Type::U32 | Type::U64 | Type::S32 | Type::S64 | Type::F32 | Type::F64
)
}
}
Expand Down

0 comments on commit f63fa19

Please sign in to comment.