fix #3749: returns count should count the returns, not the params.

This commit is contained in:
Pat Hickey
2022-02-01 09:46:46 -08:00
parent 13f17db297
commit aa4c81a4e7

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,