mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-04-24 23:02:15 +00:00
Don't require check_signature.
This commit is contained in:
parent
43d446b04c
commit
e9d05f3bc5
@ -180,18 +180,6 @@ impl<'a> Externals for Runtime<'a> {
|
||||
_ => panic!("unknown function index")
|
||||
}
|
||||
}
|
||||
|
||||
fn check_signature(&self, index: usize, sig: &FunctionType) -> bool {
|
||||
match index {
|
||||
SET_FUNC_INDEX => {
|
||||
sig.params() == &[ValueType::I32] && sig.return_type() == None
|
||||
}
|
||||
GET_FUNC_INDEX => {
|
||||
sig.params() == &[ValueType::I32] && sig.return_type() == Some(ValueType::I32)
|
||||
}
|
||||
_ => panic!("unknown function index")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct RuntimeModuleImportResolver;
|
||||
|
@ -81,13 +81,6 @@ impl Externals for SpecModule {
|
||||
_ => panic!("SpecModule doesn't provide function at index {}", index),
|
||||
}
|
||||
}
|
||||
|
||||
fn check_signature(&self, index: usize, _signature: &FunctionType) -> bool {
|
||||
match index {
|
||||
PRINT_FUNC_INDEX => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ModuleImportResolver for SpecModule {
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::any::TypeId;
|
||||
use elements::FunctionType;
|
||||
use interpreter::value::RuntimeValue;
|
||||
use interpreter::Error;
|
||||
|
||||
@ -38,8 +37,6 @@ pub trait Externals {
|
||||
index: usize,
|
||||
args: &[RuntimeValue],
|
||||
) -> Result<Option<RuntimeValue>, Error>;
|
||||
|
||||
fn check_signature(&self, index: usize, signature: &FunctionType) -> bool;
|
||||
}
|
||||
|
||||
pub struct NopExternals;
|
||||
@ -52,8 +49,4 @@ impl Externals for NopExternals {
|
||||
) -> Result<Option<RuntimeValue>, Error> {
|
||||
Err(Error::Trap("invoke index on no-op externals".into()))
|
||||
}
|
||||
|
||||
fn check_signature(&self, _index: usize, _signature: &FunctionType) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,9 @@ impl Externals for TestHost {
|
||||
_ => panic!("env doesn't provide function at index {}", index),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TestHost {
|
||||
fn check_signature(&self, index: usize, func_type: &FunctionType) -> bool {
|
||||
if index == RECURSE_FUNC_INDEX {
|
||||
// This function requires special handling because it is polymorphic.
|
||||
@ -477,10 +479,6 @@ fn defer_providing_externals() {
|
||||
_ => panic!("env module doesn't provide function at index {}", index),
|
||||
}
|
||||
}
|
||||
|
||||
fn check_signature(&self, _index: usize, func_type: &FunctionType) -> bool {
|
||||
func_type.params() == &[ValueType::I32] && func_type.return_type() == None
|
||||
}
|
||||
}
|
||||
|
||||
let module = parse_wat(
|
||||
|
Loading…
x
Reference in New Issue
Block a user