Fix return value of Func::param_arity (#1566)
Accidentally forgot to subtract 2 to account for the two vmctx parameters, so let's add a test here nad adjust it appropriately.
This commit is contained in:
@@ -502,7 +502,7 @@ impl Func {
|
||||
.signatures()
|
||||
.lookup(self.export.signature)
|
||||
.expect("failed to lookup signature");
|
||||
sig.params.len()
|
||||
sig.params.len() - 2 // skip the two vmctx leading parameters
|
||||
}
|
||||
|
||||
/// Returns the number of results this function produces.
|
||||
|
||||
@@ -74,7 +74,9 @@ fn signatures_match() {
|
||||
|
||||
let f = Func::wrap(&store, || {});
|
||||
assert_eq!(f.ty().params(), &[]);
|
||||
assert_eq!(f.param_arity(), 0);
|
||||
assert_eq!(f.ty().results(), &[]);
|
||||
assert_eq!(f.result_arity(), 0);
|
||||
|
||||
let f = Func::wrap(&store, || -> i32 { loop {} });
|
||||
assert_eq!(f.ty().params(), &[]);
|
||||
|
||||
Reference in New Issue
Block a user