Merge pull request #3750 from bytecodealliance/pch/fix_3749

fix #3749: returns count should count the returns, not the params.
This commit is contained in:
Nick Fitzgerald
2022-02-01 10:29:17 -08:00
committed by GitHub

View File

@@ -97,7 +97,10 @@ impl WasmFuncType {
#[inline] #[inline]
pub fn new(params: Box<[WasmType]>, returns: Box<[WasmType]>) -> Self { pub fn new(params: Box<[WasmType]>, returns: Box<[WasmType]>) -> Self {
let externref_params_count = params.iter().filter(|p| **p == WasmType::ExternRef).count(); let externref_params_count = params.iter().filter(|p| **p == WasmType::ExternRef).count();
let externref_returns_count = params.iter().filter(|r| **r == WasmType::ExternRef).count(); let externref_returns_count = returns
.iter()
.filter(|r| **r == WasmType::ExternRef)
.count();
WasmFuncType { WasmFuncType {
params, params,
externref_params_count, externref_params_count,