diff --git a/examples/tictactoe.rs b/examples/tictactoe.rs index b0bd551..7e8d66c 100644 --- a/examples/tictactoe.rs +++ b/examples/tictactoe.rs @@ -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; diff --git a/spec/src/run.rs b/spec/src/run.rs index dafe5d0..ba68df3 100644 --- a/spec/src/run.rs +++ b/spec/src/run.rs @@ -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 { diff --git a/src/interpreter/host.rs b/src/interpreter/host.rs index 5d1ffab..d77dc1c 100644 --- a/src/interpreter/host.rs +++ b/src/interpreter/host.rs @@ -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, Error>; - - fn check_signature(&self, index: usize, signature: &FunctionType) -> bool; } pub struct NopExternals; @@ -52,8 +49,4 @@ impl Externals for NopExternals { ) -> Result, Error> { Err(Error::Trap("invoke index on no-op externals".into())) } - - fn check_signature(&self, _index: usize, _signature: &FunctionType) -> bool { - false - } } diff --git a/src/interpreter/tests/host.rs b/src/interpreter/tests/host.rs index d8bf61b..204063a 100644 --- a/src/interpreter/tests/host.rs +++ b/src/interpreter/tests/host.rs @@ -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(