fix: simplify signatures to avoid Result usage

This commit is contained in:
Jannik Keye
2018-07-04 16:10:17 +02:00
parent 40b7b069bc
commit 7790b34c07
2 changed files with 49 additions and 128 deletions

View File

@ -986,18 +986,18 @@ extern "C" {
/// The static Reflect.apply() method calls a target function with arguments as specified.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/apply
#[wasm_bindgen(static_method_of = Reflect, catch)]
pub fn apply(target: &Function, this_argument: &JsValue, arguments_list: &Array) -> Result<JsValue, JsValue>;
#[wasm_bindgen(static_method_of = Reflect)]
pub fn apply(target: &Function, this_argument: &JsValue, arguments_list: &Array) -> JsValue;
/// The static Reflect.construct() method acts like the new operator, but as a function.
/// It is equivalent to calling new target(...args). It gives also the added option to
/// specify a different prototype.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/construct
#[wasm_bindgen(static_method_of = Reflect, catch)]
pub fn construct(target: &Function, arguments_list: &Array) -> Result<JsValue, JsValue>;
#[wasm_bindgen(static_method_of = Reflect, js_name = construct, catch)]
pub fn construct_with_new_target(target: &Function, arguments_list: &Array, new_target: &Function) -> Result<JsValue, JsValue>;
#[wasm_bindgen(static_method_of = Reflect)]
pub fn construct(target: &Function, arguments_list: &Array) -> JsValue;
#[wasm_bindgen(static_method_of = Reflect, js_name = construct)]
pub fn construct_with_new_target(target: &Function, arguments_list: &Array, new_target: &Function) -> JsValue;
/// The static Reflect.defineProperty() method is like Object.defineProperty()
/// but returns a Boolean.
@ -1010,23 +1010,23 @@ extern "C" {
/// It is like the delete operator as a function.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/deleteProperty
#[wasm_bindgen(static_method_of = Reflect, js_name = deleteProperty, catch)]
pub fn delete_property(target: &JsValue, key: &JsValue) -> Result<JsValue, JsValue>;
#[wasm_bindgen(static_method_of = Reflect, js_name = deleteProperty)]
pub fn delete_property(target: &Object, key: &JsValue) -> bool;
/// The static Reflect.get() method works like getting a property from
/// an object (target[propertyKey]) as a function.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/get
#[wasm_bindgen(static_method_of = Reflect, catch)]
pub fn get(target: &JsValue, key: &JsValue) -> Result<JsValue, JsValue>;
#[wasm_bindgen(static_method_of = Reflect)]
pub fn get(target: &Object, key: &JsValue) -> JsValue;
/// The static Reflect.getOwnPropertyDescriptor() method is similar to
/// Object.getOwnPropertyDescriptor(). It returns a property descriptor
/// of the given property if it exists on the object, undefined otherwise.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/getOwnPropertyDescriptor
#[wasm_bindgen(static_method_of = Reflect, js_name = getOwnPropertyDescriptor, catch)]
pub fn get_own_property_descriptor(target: &JsValue, property_key: &JsValue) -> Result<JsValue, JsValue>;
#[wasm_bindgen(static_method_of = Reflect, js_name = getOwnPropertyDescriptor)]
pub fn get_own_property_descriptor(target: &Object, property_key: &JsValue) -> JsValue;
/// The static Reflect.getPrototypeOf() method is almost the same
/// method as Object.getPrototypeOf(). It returns the prototype
@ -1034,8 +1034,8 @@ extern "C" {
/// the specified object.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/getPrototypeOf
#[wasm_bindgen(static_method_of = Reflect, js_name = getPrototypeOf, catch)]
pub fn get_prototype_of(target: &JsValue) -> Result<JsValue, JsValue>;
#[wasm_bindgen(static_method_of = Reflect, js_name = getPrototypeOf)]
pub fn get_prototype_of(target: &Object) -> Object;
/// The static Reflect.has() method works like the in operator as a function.
///
@ -1048,15 +1048,15 @@ extern "C" {
/// Object.isExtensible(), but with some differences.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/isExtensible
#[wasm_bindgen(static_method_of = Reflect, js_name = isExtensible, catch)]
pub fn is_extensible(target: &Object) -> Result<JsValue, JsValue>;
#[wasm_bindgen(static_method_of = Reflect, js_name = isExtensible)]
pub fn is_extensible(target: &Object) -> bool;
/// The static Reflect.ownKeys() method returns an array of the
/// target object's own property keys.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys
#[wasm_bindgen(static_method_of = Reflect, js_name = ownKeys, catch)]
pub fn own_keys(target: &Object) -> Result<JsValue, JsValue>;
#[wasm_bindgen(static_method_of = Reflect, js_name = ownKeys)]
pub fn own_keys(target: &Object) -> Array;
/// The static Reflect.preventExtensions() method prevents new
/// properties from ever being added to an object (i.e. prevents
@ -1064,17 +1064,17 @@ extern "C" {
/// Object.preventExtensions(), but with some differences.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/preventExtensions
#[wasm_bindgen(static_method_of = Reflect, js_name = preventExtensions, catch)]
pub fn prevent_extensions(target: &Object) -> Result<JsValue, JsValue>;
#[wasm_bindgen(static_method_of = Reflect, js_name = preventExtensions)]
pub fn prevent_extensions(target: &Object) -> bool;
/// The static Reflect.set() method works like setting a
/// property on an object.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set
#[wasm_bindgen(static_method_of = Reflect, catch)]
pub fn set(target: &JsValue, property_key: &JsValue, value: &JsValue) -> Result<JsValue, JsValue>;
#[wasm_bindgen(static_method_of = Reflect, js_name = set, catch)]
pub fn set_with_receiver(target: &JsValue, property_key: &JsValue, value: &JsValue, receiver: &JsValue) -> Result<JsValue, JsValue>;
#[wasm_bindgen(static_method_of = Reflect)]
pub fn set(target: &Object, property_key: &JsValue, value: &JsValue) -> bool;
#[wasm_bindgen(static_method_of = Reflect, js_name = set)]
pub fn set_with_receiver(target: &Object, property_key: &JsValue, value: &JsValue, receiver: &Object) -> bool;
/// The static Reflect.setPrototypeOf() method is the same
/// method as Object.setPrototypeOf(). It sets the prototype
@ -1082,8 +1082,8 @@ extern "C" {
/// object to another object or to null.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/setPrototypeOf
#[wasm_bindgen(static_method_of = Reflect, js_name = setPrototypeOf, catch)]
pub fn set_prototype_of(target: &JsValue, prototype: &JsValue) -> Result<JsValue, JsValue>;
#[wasm_bindgen(static_method_of = Reflect, js_name = setPrototypeOf)]
pub fn set_prototype_of(target: &Object, prototype: &JsValue) -> bool;
}
// Set