components: Fix support for 0-sized flags (#4560)

This commit goes through and updates support in the various argument
passing routines to support 0-sized flags. A bit of a degenerate case
but clarified in WebAssembly/component-model#76 as intentional.
This commit is contained in:
Alex Crichton
2022-08-01 11:05:09 -05:00
committed by GitHub
parent 05e6abf2f6
commit 893fadb485
9 changed files with 59 additions and 9 deletions

View File

@@ -210,7 +210,9 @@ fn make_echo_component(type_definition: &str, type_size: u32) -> String {
}
fn make_echo_component_with_params(type_definition: &str, params: &[Param]) -> String {
let func = if params.len() == 1 || params.len() > 16 {
let func = if params.len() == 0 {
format!("(func (export \"echo\"))")
} else if params.len() == 1 || params.len() > 16 {
let primitive = if params.len() == 1 {
params[0].0.primitive()
} else {