Don’t need catch for Module static methods

This commit is contained in:
Frazer McLean
2018-08-20 01:50:27 +02:00
parent 751f226170
commit 19ee28d769
2 changed files with 9 additions and 9 deletions

View File

@ -2961,22 +2961,22 @@ pub mod WebAssembly {
/// string name.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module/customSections
#[wasm_bindgen(static_method_of = Module, js_namespace = WebAssembly, js_name = customSections, catch)]
pub fn custom_sections(module: &Module, sectionName: &str) -> Result<Array, JsValue>;
#[wasm_bindgen(static_method_of = Module, js_namespace = WebAssembly, js_name = customSections)]
pub fn custom_sections(module: &Module, sectionName: &str) -> Array;
/// The `WebAssembly.exports()` function returns an array containing
/// descriptions of all the declared exports of the given `Module`.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module/exports
#[wasm_bindgen(static_method_of = Module, js_namespace = WebAssembly, catch)]
pub fn exports(module: &Module) -> Result<Array, JsValue>;
#[wasm_bindgen(static_method_of = Module, js_namespace = WebAssembly)]
pub fn exports(module: &Module) -> Array;
/// The `WebAssembly.imports()` function returns an array containing
/// descriptions of all the declared imports of the given `Module`.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module/imports
#[wasm_bindgen(static_method_of = Module, js_namespace = WebAssembly, catch)]
pub fn imports(module: &Module) -> Result<Array, JsValue>;
#[wasm_bindgen(static_method_of = Module, js_namespace = WebAssembly)]
pub fn imports(module: &Module) -> Array;
}
// WebAssembly.Table

View File

@ -76,21 +76,21 @@ fn module_inheritance() {
#[wasm_bindgen_test]
fn module_custom_sections() {
let module = WebAssembly::Module::new(&get_valid_wasm());
let cust_sec = WebAssembly::Module::custom_sections(&module, "abcd").unwrap();
let cust_sec = WebAssembly::Module::custom_sections(&module, "abcd");
assert_eq!(cust_sec.length(), 0);
}
#[wasm_bindgen_test]
fn module_exports() {
let module = WebAssembly::Module::new(&get_valid_wasm());
let exports = WebAssembly::Module::exports(&module).unwrap();
let exports = WebAssembly::Module::exports(&module);
assert_eq!(exports.length(), 1);
}
#[wasm_bindgen_test]
fn module_imports() {
let module = WebAssembly::Module::new(&get_valid_wasm());
let imports = WebAssembly::Module::imports(&module).unwrap();
let imports = WebAssembly::Module::imports(&module);
assert_eq!(imports.length(), 1);
}