Skip to content

Commit

Permalink
Feature: Skeleton code for Number
Browse files Browse the repository at this point in the history
  • Loading branch information
pop committed Oct 9, 2019
1 parent 8a26988 commit 12c6647
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
Binary file added src/lib/js/.string.rs.swp
Binary file not shown.
2 changes: 2 additions & 0 deletions src/lib/js/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
97 changes: 97 additions & 0 deletions src/lib/js/number.rs
Original file line number Diff line number Diff line change
@@ -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!()
}
}

0 comments on commit 12c6647

Please sign in to comment.