Transform Math into a namespace

This commit is contained in:
Ingvar Stepanyan 2019-04-13 02:09:52 +01:00
parent 744b031ad4
commit fe939bc911
2 changed files with 212 additions and 224 deletions

View File

@ -1186,18 +1186,18 @@ extern "C" {
pub fn value(this: &IteratorNext) -> JsValue; pub fn value(this: &IteratorNext) -> JsValue;
} }
// Math #[allow(non_snake_case)]
#[wasm_bindgen] pub mod Math {
extern "C" { use super::*;
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub type Math;
// Math
#[wasm_bindgen]
extern "C" {
/// The Math.abs() function returns the absolute value of a number, that is /// The Math.abs() function returns the absolute value of a number, that is
/// Math.abs(x) = |x| /// Math.abs(x) = |x|
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn abs(x: f64) -> f64; pub fn abs(x: f64) -> f64;
/// The Math.acos() function returns the arccosine (in radians) of a /// The Math.acos() function returns the arccosine (in radians) of a
@ -1205,7 +1205,7 @@ extern "C" {
/// Math.acos(x) = arccos(x) = the unique y∊[0;π] such that cos(y)=x /// Math.acos(x) = arccos(x) = the unique y∊[0;π] such that cos(y)=x
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acos) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acos)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn acos(x: f64) -> f64; pub fn acos(x: f64) -> f64;
/// The Math.acosh() function returns the hyperbolic arc-cosine of a /// The Math.acosh() function returns the hyperbolic arc-cosine of a
@ -1213,7 +1213,7 @@ extern "C" {
/// Math.acosh(x) = arcosh(x) = the unique y ≥ 0 such that cosh(y) = x /// Math.acosh(x) = arcosh(x) = the unique y ≥ 0 such that cosh(y) = x
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acosh) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acosh)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn acosh(x: f64) -> f64; pub fn acosh(x: f64) -> f64;
/// The Math.asin() function returns the arcsine (in radians) of a /// The Math.asin() function returns the arcsine (in radians) of a
@ -1221,27 +1221,27 @@ extern "C" {
/// Math.asin(x) = arcsin(x) = the unique y∊[-π2;π2] such that sin(y) = x /// Math.asin(x) = arcsin(x) = the unique y∊[-π2;π2] such that sin(y) = x
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asin) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asin)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn asin(x: f64) -> f64; pub fn asin(x: f64) -> f64;
/// The Math.asinh() function returns the hyperbolic arcsine of a /// The Math.asinh() function returns the hyperbolic arcsine of a
/// number, that is Math.asinh(x) = arsinh(x) = the unique y such that sinh(y) = x /// number, that is Math.asinh(x) = arsinh(x) = the unique y such that sinh(y) = x
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asinh) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asinh)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn asinh(x: f64) -> f64; pub fn asinh(x: f64) -> f64;
/// The Math.atan() function returns the arctangent (in radians) of a /// The Math.atan() function returns the arctangent (in radians) of a
/// number, that is Math.atan(x) = arctan(x) = the unique y ∊ [-π2;π2]such that /// number, that is Math.atan(x) = arctan(x) = the unique y ∊ [-π2;π2]such that
/// tan(y) = x /// tan(y) = x
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn atan(x: f64) -> f64; pub fn atan(x: f64) -> f64;
/// The Math.atan2() function returns the arctangent of the quotient of /// The Math.atan2() function returns the arctangent of the quotient of
/// its arguments. /// its arguments.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn atan2(y: f64, x: f64) -> f64; pub fn atan2(y: f64, x: f64) -> f64;
/// The Math.atanh() function returns the hyperbolic arctangent of a number, /// The Math.atanh() function returns the hyperbolic arctangent of a number,
@ -1249,125 +1249,125 @@ extern "C" {
/// tanh(y) = x /// tanh(y) = x
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atanh) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atanh)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn atanh(x: f64) -> f64; pub fn atanh(x: f64) -> f64;
/// The Math.cbrt() function returns the cube root of a number, that is /// The Math.cbrt() function returns the cube root of a number, that is
/// Math.cbrt(x) = x^3 = the unique y such that y^3 = x /// Math.cbrt(x) = x^3 = the unique y such that y^3 = x
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cbrt) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cbrt)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn cbrt(x: f64) -> f64; pub fn cbrt(x: f64) -> f64;
/// The Math.ceil() function returns the smallest integer greater than /// The Math.ceil() function returns the smallest integer greater than
/// or equal to a given number. /// or equal to a given number.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn ceil(x: f64) -> f64; pub fn ceil(x: f64) -> f64;
/// The Math.clz32() function returns the number of leading zero bits in /// The Math.clz32() function returns the number of leading zero bits in
/// the 32-bit binary representation of a number. /// the 32-bit binary representation of a number.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn clz32(x: i32) -> u32; pub fn clz32(x: i32) -> u32;
/// The Math.cos() static function returns the cosine of the specified angle, /// The Math.cos() static function returns the cosine of the specified angle,
/// which must be specified in radians. This value is length(adjacent)/length(hypotenuse). /// which must be specified in radians. This value is length(adjacent)/length(hypotenuse).
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cos) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cos)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn cos(x: f64) -> f64; pub fn cos(x: f64) -> f64;
/// The Math.cosh() function returns the hyperbolic cosine of a number, /// The Math.cosh() function returns the hyperbolic cosine of a number,
/// that can be expressed using the constant e. /// that can be expressed using the constant e.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cosh) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cosh)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn cosh(x: f64) -> f64; pub fn cosh(x: f64) -> f64;
/// The Math.exp() function returns e^x, where x is the argument, and e is Euler's number /// The Math.exp() function returns e^x, where x is the argument, and e is Euler's number
/// (also known as Napier's constant), the base of the natural logarithms. /// (also known as Napier's constant), the base of the natural logarithms.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/exp) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/exp)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn exp(x: f64) -> f64; pub fn exp(x: f64) -> f64;
/// The Math.expm1() function returns e^x - 1, where x is the argument, and e the base of the /// The Math.expm1() function returns e^x - 1, where x is the argument, and e the base of the
/// natural logarithms. /// natural logarithms.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/expm1) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/expm1)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn expm1(x: f64) -> f64; pub fn expm1(x: f64) -> f64;
/// The Math.floor() function returns the largest integer less than or /// The Math.floor() function returns the largest integer less than or
/// equal to a given number. /// equal to a given number.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn floor(x: f64) -> f64; pub fn floor(x: f64) -> f64;
/// The Math.fround() function returns the nearest 32-bit single precision float representation /// The Math.fround() function returns the nearest 32-bit single precision float representation
/// of a Number. /// of a Number.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn fround(x: f64) -> f32; pub fn fround(x: f64) -> f32;
/// The Math.hypot() function returns the square root of the sum of squares of its arguments. /// The Math.hypot() function returns the square root of the sum of squares of its arguments.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn hypot(x: f64, y: f64) -> f64; pub fn hypot(x: f64, y: f64) -> f64;
/// The Math.imul() function returns the result of the C-like 32-bit multiplication of the /// The Math.imul() function returns the result of the C-like 32-bit multiplication of the
/// two parameters. /// two parameters.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn imul(x: i32, y: i32) -> i32; pub fn imul(x: i32, y: i32) -> i32;
/// The Math.log() function returns the natural logarithm (base e) of a number. /// The Math.log() function returns the natural logarithm (base e) of a number.
/// The JavaScript Math.log() function is equivalent to ln(x) in mathematics. /// The JavaScript Math.log() function is equivalent to ln(x) in mathematics.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn log(x: f64) -> f64; pub fn log(x: f64) -> f64;
/// The Math.log10() function returns the base 10 logarithm of a number. /// The Math.log10() function returns the base 10 logarithm of a number.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log10) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log10)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn log10(x: f64) -> f64; pub fn log10(x: f64) -> f64;
/// The Math.log1p() function returns the natural logarithm (base e) of 1 + a number. /// The Math.log1p() function returns the natural logarithm (base e) of 1 + a number.
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log1p) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log1p)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn log1p(x: f64) -> f64; pub fn log1p(x: f64) -> f64;
/// The Math.log2() function returns the base 2 logarithm of a number. /// The Math.log2() function returns the base 2 logarithm of a number.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log2) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log2)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn log2(x: f64) -> f64; pub fn log2(x: f64) -> f64;
/// The Math.max() function returns the largest of two numbers. /// The Math.max() function returns the largest of two numbers.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn max(x: f64, y: f64) -> f64; pub fn max(x: f64, y: f64) -> f64;
/// The static function Math.min() returns the lowest-valued number passed into it. /// The static function Math.min() returns the lowest-valued number passed into it.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn min(x: f64, y: f64) -> f64; pub fn min(x: f64, y: f64) -> f64;
/// The Math.pow() function returns the base to the exponent power, that is, base^exponent. /// The Math.pow() function returns the base to the exponent power, that is, base^exponent.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn pow(base: f64, exponent: f64) -> f64; pub fn pow(base: f64, exponent: f64) -> f64;
/// The Math.random() function returns a floating-point, pseudo-random number /// The Math.random() function returns a floating-point, pseudo-random number
@ -1377,61 +1377,62 @@ extern "C" {
/// it cannot be chosen or reset by the user. /// it cannot be chosen or reset by the user.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn random() -> f64; pub fn random() -> f64;
/// The Math.round() function returns the value of a number rounded to the nearest integer. /// The Math.round() function returns the value of a number rounded to the nearest integer.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn round(x: f64) -> f64; pub fn round(x: f64) -> f64;
/// The Math.sign() function returns the sign of a number, indicating whether the number is /// The Math.sign() function returns the sign of a number, indicating whether the number is
/// positive, negative or zero. /// positive, negative or zero.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn sign(x: f64) -> f64; pub fn sign(x: f64) -> f64;
/// The Math.sin() function returns the sine of a number. /// The Math.sin() function returns the sine of a number.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sin) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sin)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn sin(x: f64) -> f64; pub fn sin(x: f64) -> f64;
/// The Math.sinh() function returns the hyperbolic sine of a number, that can be expressed /// The Math.sinh() function returns the hyperbolic sine of a number, that can be expressed
/// using the constant e: Math.sinh(x) = (e^x - e^-x)/2 /// using the constant e: Math.sinh(x) = (e^x - e^-x)/2
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sinh) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sinh)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn sinh(x: f64) -> f64; pub fn sinh(x: f64) -> f64;
/// The Math.sqrt() function returns the square root of a number, that is /// The Math.sqrt() function returns the square root of a number, that is
/// ∀x ≥ 0, Math.sqrt(x) = √x = the unique y ≥ 0 such that y^2 = x /// ∀x ≥ 0, Math.sqrt(x) = √x = the unique y ≥ 0 such that y^2 = x
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sqrt) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sqrt)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn sqrt(x: f64) -> f64; pub fn sqrt(x: f64) -> f64;
/// The Math.tan() function returns the tangent of a number. /// The Math.tan() function returns the tangent of a number.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tan) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tan)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn tan(x: f64) -> f64; pub fn tan(x: f64) -> f64;
/// The Math.tanh() function returns the hyperbolic tangent of a number, that is /// The Math.tanh() function returns the hyperbolic tangent of a number, that is
/// tanh x = sinh x / cosh x = (e^x - e^-x)/(e^x + e^-x) = (e^2x - 1)/(e^2x + 1) /// tanh x = sinh x / cosh x = (e^x - e^-x)/(e^x + e^-x) = (e^2x - 1)/(e^2x + 1)
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tanh) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tanh)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn tanh(x: f64) -> f64; pub fn tanh(x: f64) -> f64;
/// The Math.trunc() function returns the integer part of a number by removing any fractional /// The Math.trunc() function returns the integer part of a number by removing any fractional
/// digits. /// digits.
/// ///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc) /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc)
#[wasm_bindgen(static_method_of = Math)] #[wasm_bindgen(js_namespace = Math)]
pub fn trunc(x: f64) -> f64; pub fn trunc(x: f64) -> f64;
}
} }
// Number. // Number.

View File

@ -2,21 +2,8 @@ use std::f64::consts::PI;
use std::f64::{NAN, NEG_INFINITY}; use std::f64::{NAN, NEG_INFINITY};
use js_sys::*; use js_sys::*;
use wasm_bindgen::{prelude::*, JsCast};
use wasm_bindgen_test::*; use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn math_extends() {
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_name = Math)]
static math: Math;
}
assert!(math.is_instance_of::<Object>());
let _: &Object = math.as_ref();
}
macro_rules! assert_eq { macro_rules! assert_eq {
($a:expr, $b:expr) => {{ ($a:expr, $b:expr) => {{
let (a, b) = (&$a, &$b); let (a, b) = (&$a, &$b);