From 34776aceaede2cd7a44078f649aa062bbf4f08a0 Mon Sep 17 00:00:00 2001 From: "Elijah C. M. Voigt" Date: Tue, 8 Oct 2019 21:02:29 -0700 Subject: [PATCH] Feature: Skeleton code for Number refs #34 --- src/lib/js/.string.rs.swp | Bin 0 -> 16384 bytes src/lib/js/mod.rs | 2 + src/lib/js/number.rs | 97 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 src/lib/js/.string.rs.swp create mode 100644 src/lib/js/number.rs diff --git a/src/lib/js/.string.rs.swp b/src/lib/js/.string.rs.swp new file mode 100644 index 0000000000000000000000000000000000000000..10aacd640fbf159a7b7a71feb0c0a81393dd9a2a GIT binary patch literal 16384 zcmeHNO^h5z6>e}a;9wHj2!%^jo)vLVnCEggWuBiHYJbDD+wqSM zwZCrK?={bFHViDE|CsiMX%|E7ubK8^ru}zA?f*9IpET_yBao&4s%bxH+WAoXD?{`j z9co`?###QW%>zr{G#6im1_})n8YnbSXrRzQp@BjJg$4=@6dEWrP-x(7sR3ShocCd7 z57I^!|Npo9_m^*RoWB6i06zofff?W!Yfjz*7fhX~v!~MW6U^Q?PunPF@YRCB$ z@Zx(M=cm9?;GZ{P9zYY=4{Qbgg>!(v0?z>#fQNw{!0o^jI79dr5CScr4A4Q#Q_%I3 zz!l&p0O|e#z+TK;oiuERGMp7NvpjO>;p8b-CUn;ozP~eQ@pQsm(VQ7-x})o3h1t#=pDmx}v z)=Iij-SXiv6YY+iWBMHp7G`P?zLKtFNrR<4ZVElgNJz_KoDE3lkt~^8#;YLRSh{9n z;8&ZI0<*~&_)NNEWtMbA%4L|uo}JRcL<%NbT;c;AZQp~rzRazOfOj*&j!f?z-A;Y* z&PgW{r^~F@3M0XqLQ1@10uqA7-F8i+n7ifBjl&?R3yi@>CkbPj*{0nbZ>(UP2i3XY z7&C4)(Nk(_V*M1=UYej^Dza`QE2Ltunqxc_M#eZH0rK1x4^N!#;C&gl)ZmzBoymlC zpelip&2C%7k~NZ)>2+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-4SKWU`NYyaZh!KIoNq)t`{kfQ~-MENXb!?!3RC2 z{j@m;8fSY@`*g97(R(!%D^Yuhih2ezQ`F}Bx`?thCr*vXV`k{ELhS~L(a3Qef=X<7 z=;pe-Fq1r$#t*SHOPa^B=Dx6aUY?w|PGY%59-ucsPDxBsFFQH-Vt!UPAmjj@8-!>kp4QoX{nUjJRcrecDpr}7{2MN@1$&iaQ>ZPKCO_sZv zGN(g5>B@P7qaNVns+>*OTM<(cTc%@g$#j8hZYIl#ut_Cf_x>#_v;(-|bN@+l~m z12XAz?`xU`8Kb2!I1#%5YbbMjE&RbCnhP!ug@mzjBOF5?iX8xomjqJ+D|&6uKxwsMFnyI literal 0 HcmV?d00001 diff --git a/src/lib/js/mod.rs b/src/lib/js/mod.rs index 1c59657f314..3d549fa4455 100644 --- a/src/lib/js/mod.rs +++ b/src/lib/js/mod.rs @@ -12,6 +12,8 @@ pub mod function; pub mod json; /// The global `Math` object pub mod math; +/// The global `Number` object +pub mod number; /// The global `Object` object pub mod object; /// The global 'RegExp' object diff --git a/src/lib/js/number.rs b/src/lib/js/number.rs new file mode 100644 index 00000000000..a27a5625829 --- /dev/null +++ b/src/lib/js/number.rs @@ -0,0 +1,97 @@ +use crate::{ + exec::Interpreter, + js::value::{ResultValue, Value}, +}; + +/// Create a new number [[Construct]] +pub fn make_number(this: &Value, args: &[Value], ctx: &mut Interpreter) -> ResultValue { + unimplemented!() +} + +/// https://tc39.es/ecma262/#sec-number-constructor-number-value +pub fn call_number(this: &Value, args: &[Value], ctx: &mut Interpreter) -> ResultValue { + unimplemented!() +} + +/// https://tc39.es/ecma262/#sec-number.prototype.toexponential +pub fn to_expotential(this: &Value, args: &[Value], ctx: &mut Interpreter) -> ResultValue { + unimplemented!() +} + +/// https://tc39.es/ecma262/#sec-number.prototype.tofixed +pub fn to_fixed(this: &Value, args: &[Value], ctx: &mut Interpreter) -> ResultValue { + unimplemented!() +} + +/// https://tc39.es/ecma262/#sec-number.prototype.tolocalestring +pub fn to_locale_string(this: &Value, args: &[Value], ctx: &mut Interpreter) -> ResultValue { + unimplemented!() +} + +/// https://tc39.es/ecma262/#sec-number.prototype.toprecision +pub fn to_precision(this: &Value, args: &[Value], ctx: &mut Interpreter) -> ResultValue { + unimplemented!() +} + +/// https://tc39.es/ecma262/#sec-number.prototype.tostring +pub fn to_string(this: &Value, args: &[Value], ctx: &mut Interpreter) -> ResultValue { + unimplemented!() +} + +/// https://tc39.es/ecma262/#sec-number.prototype.valueof +pub fn value_of(this: &Value, args: &[Value], ctx: &mut Interpreter) -> ResultValue { + unimplemented!() +} + +/// Create a new `Number` object +pub fn create_constructor(global: &Value) -> Value { + unimplemented!() +} + +/// Iniitalize the `Number` object on the global object +pub fn init(global: &Value) { + unimplemented!() +} + +#[cfg(test)] +mod tests { + #[test] + fn make_number() { + unimplemented!() + } + + #[test] + pub fn call_number() { + unimplemented!() + } + + #[test] + pub fn to_expotential() { + unimplemented!() + } + + #[test] + pub fn to_fixed() { + unimplemented!() + } + + #[test] + pub fn to_locale_string() { + unimplemented!() + } + + #[test] + pub fn to_precision() { + unimplemented!() + } + + #[test] + pub fn to_string() { + unimplemented!() + } + + #[test] + pub fn value_of() { + unimplemented!() + } +}