Transform Reflect into a namespace

This commit is contained in:
Ingvar Stepanyan
2019-04-13 02:11:44 +01:00
parent fe939bc911
commit 75c2971ab9
2 changed files with 139 additions and 150 deletions

View File

@ -2233,163 +2233,164 @@ extern "C" {
pub fn new(message: &str) -> ReferenceError;
}
// Reflect
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub type Reflect;
#[allow(non_snake_case)]
pub mod Reflect {
use super::*;
/// The static `Reflect.apply()` method calls a target function with
/// arguments as specified.
///
/// [MDN documentation](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>;
// Reflect
#[wasm_bindgen]
extern "C" {
/// The static `Reflect.apply()` method calls a target function with
/// arguments as specified.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/apply)
#[wasm_bindgen(js_namespace = Reflect, catch)]
pub fn apply(
target: &Function,
this_argument: &JsValue,
arguments_list: &Array,
) -> Result<JsValue, 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.
///
/// [MDN documentation](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>;
/// 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.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/construct)
#[wasm_bindgen(js_namespace = Reflect, catch)]
pub fn construct(target: &Function, arguments_list: &Array) -> Result<JsValue, 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.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/construct)
#[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>;
/// 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.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/construct)
#[wasm_bindgen(js_namespace = Reflect, js_name = construct, catch)]
pub fn construct_with_new_target(
target: &Function,
arguments_list: &Array,
new_target: &Function,
) -> Result<JsValue, JsValue>;
/// The static `Reflect.defineProperty()` method is like
/// `Object.defineProperty()` but returns a `Boolean`.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/defineProperty)
#[wasm_bindgen(static_method_of = Reflect, js_name = defineProperty, catch)]
pub fn define_property(
target: &Object,
property_key: &JsValue,
attributes: &Object,
) -> Result<bool, JsValue>;
/// The static `Reflect.defineProperty()` method is like
/// `Object.defineProperty()` but returns a `Boolean`.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/defineProperty)
#[wasm_bindgen(js_namespace = Reflect, js_name = defineProperty, catch)]
pub fn define_property(
target: &Object,
property_key: &JsValue,
attributes: &Object,
) -> Result<bool, JsValue>;
/// The static `Reflect.deleteProperty()` method allows to delete
/// properties. It is like the `delete` operator as a function.
///
/// [MDN documentation](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: &Object, key: &JsValue) -> Result<bool, JsValue>;
/// The static `Reflect.deleteProperty()` method allows to delete
/// properties. It is like the `delete` operator as a function.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/deleteProperty)
#[wasm_bindgen(js_namespace = Reflect, js_name = deleteProperty, catch)]
pub fn delete_property(target: &Object, key: &JsValue) -> Result<bool, JsValue>;
/// The static `Reflect.get()` method works like getting a property from
/// an object (`target[propertyKey]`) as a function.
///
/// [MDN documentation](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>;
/// The static `Reflect.get()` method works like getting a property from
/// an object (`target[propertyKey]`) as a function.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/get)
#[wasm_bindgen(js_namespace = Reflect, catch)]
pub fn get(target: &JsValue, key: &JsValue) -> Result<JsValue, JsValue>;
/// The same as [`Reflect::get`](#method.get) except the key is an `f64`, which is slightly faster.
#[wasm_bindgen(static_method_of = Reflect, js_name = "get", catch)]
pub fn get_f64(target: &JsValue, key: f64) -> Result<JsValue, JsValue>;
/// The same as [`Reflect::get`](#method.get) except the key is an `f64`, which is slightly faster.
#[wasm_bindgen(js_namespace = Reflect, js_name = "get", catch)]
pub fn get_f64(target: &JsValue, key: f64) -> Result<JsValue, JsValue>;
/// The same as [`Reflect::get`](#method.get) except the key is a `u32`, which is slightly faster.
#[wasm_bindgen(static_method_of = Reflect, js_name = "get", catch)]
pub fn get_u32(target: &JsValue, key: u32) -> Result<JsValue, JsValue>;
/// The same as [`Reflect::get`](#method.get) except the key is a `u32`, which is slightly faster.
#[wasm_bindgen(js_namespace = Reflect, js_name = "get", catch)]
pub fn get_u32(target: &JsValue, key: u32) -> Result<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.
///
/// [MDN documentation](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: &Object,
property_key: &JsValue,
) -> Result<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.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/getOwnPropertyDescriptor)
#[wasm_bindgen(js_namespace = Reflect, js_name = getOwnPropertyDescriptor, catch)]
pub fn get_own_property_descriptor(
target: &Object,
property_key: &JsValue,
) -> Result<JsValue, JsValue>;
/// The static `Reflect.getPrototypeOf()` method is almost the same
/// method as `Object.getPrototypeOf()`. It returns the prototype
/// (i.e. the value of the internal `[[Prototype]]` property) of
/// the specified object.
///
/// [MDN documentation](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<Object, JsValue>;
/// The static `Reflect.getPrototypeOf()` method is almost the same
/// method as `Object.getPrototypeOf()`. It returns the prototype
/// (i.e. the value of the internal `[[Prototype]]` property) of
/// the specified object.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/getPrototypeOf)
#[wasm_bindgen(js_namespace = Reflect, js_name = getPrototypeOf, catch)]
pub fn get_prototype_of(target: &JsValue) -> Result<Object, JsValue>;
/// The static `Reflect.has()` method works like the in operator as a
/// function.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/has)
#[wasm_bindgen(static_method_of = Reflect, catch)]
pub fn has(target: &JsValue, property_key: &JsValue) -> Result<bool, JsValue>;
/// The static `Reflect.has()` method works like the in operator as a
/// function.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/has)
#[wasm_bindgen(js_namespace = Reflect, catch)]
pub fn has(target: &JsValue, property_key: &JsValue) -> Result<bool, JsValue>;
/// The static `Reflect.isExtensible()` method determines if an object is
/// extensible (whether it can have new properties added to it). It is
/// similar to `Object.isExtensible()`, but with some differences.
///
/// [MDN documentation](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<bool, JsValue>;
/// The static `Reflect.isExtensible()` method determines if an object is
/// extensible (whether it can have new properties added to it). It is
/// similar to `Object.isExtensible()`, but with some differences.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/isExtensible)
#[wasm_bindgen(js_namespace = Reflect, js_name = isExtensible, catch)]
pub fn is_extensible(target: &Object) -> Result<bool, JsValue>;
/// The static `Reflect.ownKeys()` method returns an array of the
/// target object's own property keys.
///
/// [MDN documentation](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: &JsValue) -> Result<Array, JsValue>;
/// The static `Reflect.ownKeys()` method returns an array of the
/// target object's own property keys.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys)
#[wasm_bindgen(js_namespace = Reflect, js_name = ownKeys, catch)]
pub fn own_keys(target: &JsValue) -> Result<Array, JsValue>;
/// The static `Reflect.preventExtensions()` method prevents new
/// properties from ever being added to an object (i.e. prevents
/// future extensions to the object). It is similar to
/// `Object.preventExtensions()`, but with some differences.
///
/// [MDN documentation](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<bool, JsValue>;
/// The static `Reflect.preventExtensions()` method prevents new
/// properties from ever being added to an object (i.e. prevents
/// future extensions to the object). It is similar to
/// `Object.preventExtensions()`, but with some differences.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/preventExtensions)
#[wasm_bindgen(js_namespace = Reflect, js_name = preventExtensions, catch)]
pub fn prevent_extensions(target: &Object) -> Result<bool, JsValue>;
/// The static `Reflect.set()` method works like setting a
/// property on an object.
///
/// [MDN documentation](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<bool, JsValue>;
/// The static `Reflect.set()` method works like setting a
/// property on an object.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set)
#[wasm_bindgen(js_namespace = Reflect, catch)]
pub fn set(target: &JsValue, property_key: &JsValue, value: &JsValue) -> Result<bool, JsValue>;
/// The same as [`Reflect::set`](#method.set) except the key is an `f64`, which is slightly faster.
#[wasm_bindgen(static_method_of = Reflect, js_name = "set", catch)]
pub fn set_f64(target: &JsValue, property_key: f64, value: &JsValue) -> Result<bool, JsValue>;
/// The same as [`Reflect::set`](#method.set) except the key is an `f64`, which is slightly faster.
#[wasm_bindgen(js_namespace = Reflect, js_name = "set", catch)]
pub fn set_f64(target: &JsValue, property_key: f64, value: &JsValue) -> Result<bool, JsValue>;
/// The same as [`Reflect::set`](#method.set) except the key is a `u32`, which is slightly faster.
#[wasm_bindgen(static_method_of = Reflect, js_name = "set", catch)]
pub fn set_u32(target: &JsValue, property_key: u32, value: &JsValue) -> Result<bool, JsValue>;
/// The same as [`Reflect::set`](#method.set) except the key is a `u32`, which is slightly faster.
#[wasm_bindgen(js_namespace = Reflect, js_name = "set", catch)]
pub fn set_u32(target: &JsValue, property_key: u32, value: &JsValue) -> Result<bool, JsValue>;
/// The static `Reflect.set()` method works like setting a
/// property on an object.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set)
#[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<bool, JsValue>;
/// The static `Reflect.set()` method works like setting a
/// property on an object.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set)
#[wasm_bindgen(js_namespace = Reflect, js_name = set, catch)]
pub fn set_with_receiver(
target: &JsValue,
property_key: &JsValue,
value: &JsValue,
receiver: &JsValue,
) -> Result<bool, JsValue>;
/// The static `Reflect.setPrototypeOf()` method is the same
/// method as `Object.setPrototypeOf()`. It sets the prototype
/// (i.e., the internal `[[Prototype]]` property) of a specified
/// object to another object or to null.
///
/// [MDN documentation](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: &Object, prototype: &JsValue) -> Result<bool, JsValue>;
/// The static `Reflect.setPrototypeOf()` method is the same
/// method as `Object.setPrototypeOf()`. It sets the prototype
/// (i.e., the internal `[[Prototype]]` property) of a specified
/// object to another object or to null.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/setPrototypeOf)
#[wasm_bindgen(js_namespace = Reflect, js_name = setPrototypeOf, catch)]
pub fn set_prototype_of(target: &Object, prototype: &JsValue) -> Result<bool, JsValue>;
}
}
// RegExp