Use is_wasm_parameter in translating wasm calls (#1352)

* Use `is_wasm_parameter` in translating wasm calls

Added in #1329 it's now possible for multiple parameters to be non-wasm
parameters, so the previous `param_types` method is no longer suitable
for acquiring all wasm-related parameters, rather then `FuncEnvironment`
must be consulted. This removes usage of `param_types()` as a method
from the wasm translation and instead adds a custom method inline for
filtering the parameters based on `is_wasm_parameter`.

* Apply feedback

* Run rustfmt

* Don't require `mut`

* Run rustfmt
This commit is contained in:
Alex Crichton
2020-01-17 14:11:54 -06:00
committed by Dan Gohman
parent e1d513ab4b
commit 1266b68f9a
4 changed files with 35 additions and 23 deletions

View File

@@ -102,24 +102,6 @@ impl Signature {
.count()
> 1
}
/// Collect the normal parameter types of the signature; see `[ArgumentPurpose::Normal]`.
pub fn param_types(&self) -> Vec<Type> {
self.params
.iter()
.filter(|ap| ap.purpose == ArgumentPurpose::Normal)
.map(|ap| ap.value_type)
.collect()
}
/// Collect the normal return types of the signature; see `[ArgumentPurpose::Normal]`.
pub fn return_types(&self) -> Vec<Type> {
self.returns
.iter()
.filter(|ap| ap.purpose == ArgumentPurpose::Normal)
.map(|ap| ap.value_type)
.collect()
}
}
/// Wrapper type capable of displaying a `Signature` with correct register names.