Skip to content

Commit 59c04e2

Browse files
committed
Port Reflect tests to wasm
1 parent 315b5d8 commit 59c04e2

File tree

7 files changed

+220
-613
lines changed

7 files changed

+220
-613
lines changed

crates/js-sys/src/lib.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ extern "C" {
112112
#[wasm_bindgen]
113113
pub fn escape(string: &str) -> JsString;
114114

115-
/// The unescape() function computes a new string in which hexadecimal escape
116-
/// sequences are replaced with the character that it represents. The escape sequences might
115+
/// The unescape() function computes a new string in which hexadecimal escape
116+
/// sequences are replaced with the character that it represents. The escape sequences might
117117
/// be introduced by a function like escape. Usually, decodeURI or decodeURIComponent
118118
/// are preferred over unescape.
119119
///
@@ -1859,8 +1859,9 @@ extern "C" {
18591859
/// arguments as specified.
18601860
///
18611861
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/apply
1862-
#[wasm_bindgen(static_method_of = Reflect)]
1863-
pub fn apply(target: &Function, this_argument: &JsValue, arguments_list: &Array) -> JsValue;
1862+
#[wasm_bindgen(static_method_of = Reflect, catch)]
1863+
pub fn apply(target: &Function, this_argument: &JsValue, arguments_list: &Array)
1864+
-> Result<JsValue, JsValue>;
18641865

18651866
/// The static `Reflect.construct()` method acts like the new operator, but
18661867
/// as a function. It is equivalent to calling `new target(...args)`. It
@@ -1891,7 +1892,7 @@ extern "C" {
18911892
///
18921893
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/get
18931894
#[wasm_bindgen(static_method_of = Reflect)]
1894-
pub fn get(target: &Object, key: &JsValue) -> JsValue;
1895+
pub fn get(target: &JsValue, key: &JsValue) -> JsValue;
18951896

18961897
/// The static `Reflect.getOwnPropertyDescriptor()` method is similar to
18971898
/// `Object.getOwnPropertyDescriptor()`. It returns a property descriptor
@@ -1908,14 +1909,14 @@ extern "C" {
19081909
///
19091910
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/getPrototypeOf
19101911
#[wasm_bindgen(static_method_of = Reflect, js_name = getPrototypeOf)]
1911-
pub fn get_prototype_of(target: &Object) -> Object;
1912+
pub fn get_prototype_of(target: &JsValue) -> Object;
19121913

19131914
/// The static `Reflect.has()` method works like the in operator as a
19141915
/// function.
19151916
///
19161917
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/has
19171918
#[wasm_bindgen(static_method_of = Reflect)]
1918-
pub fn has(target: &Object, property_key: &JsValue) -> bool;
1919+
pub fn has(target: &JsValue, property_key: &JsValue) -> bool;
19191920

19201921
/// The static `Reflect.isExtensible()` method determines if an object is
19211922
/// extensible (whether it can have new properties added to it). It is
@@ -1930,7 +1931,7 @@ extern "C" {
19301931
///
19311932
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys
19321933
#[wasm_bindgen(static_method_of = Reflect, js_name = ownKeys)]
1933-
pub fn own_keys(target: &Object) -> Array;
1934+
pub fn own_keys(target: &JsValue) -> Array;
19341935

19351936
/// The static `Reflect.preventExtensions()` method prevents new
19361937
/// properties from ever being added to an object (i.e. prevents
@@ -1946,9 +1947,9 @@ extern "C" {
19461947
///
19471948
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set
19481949
#[wasm_bindgen(static_method_of = Reflect)]
1949-
pub fn set(target: &Object, property_key: &JsValue, value: &JsValue) -> bool;
1950+
pub fn set(target: &JsValue, property_key: &JsValue, value: &JsValue) -> bool;
19501951
#[wasm_bindgen(static_method_of = Reflect, js_name = set)]
1951-
pub fn set_with_receiver(target: &Object, property_key: &JsValue, value: &JsValue, receiver: &Object) -> bool;
1952+
pub fn set_with_receiver(target: &JsValue, property_key: &JsValue, value: &JsValue, receiver: &JsValue) -> bool;
19521953

19531954
/// The static `Reflect.setPrototypeOf()` method is the same
19541955
/// method as `Object.setPrototypeOf()`. It sets the prototype

0 commit comments

Comments
 (0)