Correctly count the number of wasm parameters. (#1337)

* Correctly count the number of wasm parameters.

Following up on #1329, this further replaces `num_normal_params` with a function
which calls `is_wasm_parameter` to correctly count the number of wasm
parameters a function has.

* Move is_wasm_parameter's implementation into the trait.
This commit is contained in:
Dan Gohman
2020-01-14 11:42:22 -08:00
committed by GitHub
parent dd497c19e1
commit 1d504ecf6d
5 changed files with 18 additions and 18 deletions

View File

@@ -88,16 +88,6 @@ impl Signature {
.count()
}
/// Count the number of normal parameters in a signature.
/// Exclude special-purpose parameters that represent runtime stuff and not WebAssembly
/// arguments.
pub fn num_normal_params(&self) -> usize {
self.params
.iter()
.filter(|arg| arg.purpose == ArgumentPurpose::Normal)
.count()
}
/// Does this signature take an struct return pointer parameter?
pub fn uses_struct_return_param(&self) -> bool {
self.uses_special_param(ArgumentPurpose::StructReturn)