Browse Source

Added some documentation to builtins/function

pull/293/head
HalidOdat 5 years ago
parent
commit
da6872a265
  1. 20
      boa/src/builtins/function/mod.rs
  2. 1
      boa/src/builtins/mod.rs

20
boa/src/builtins/function/mod.rs

@ -1,3 +1,14 @@
//! This module implements the global `Function` object.
//!
//! `Every JavaScript `function` is actually a `Function` object.
//!
//! More information:
//! - [ECMAScript reference][spec]
//! - [MDN documentation][mdn]
//!
//! [spec]: https://tc39.es/ecma262/#sec-function-object
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function
#[cfg(test)]
mod tests;
@ -18,12 +29,11 @@ use std::ops::Deref;
/// fn(this, arguments, ctx)
pub type NativeFunctionData = fn(&Value, &[Value], &mut Interpreter) -> ResultValue;
/// A Javascript function
/// A Javascript `Function` object instance.
///
/// A member of the Object type that may be invoked as a subroutine
/// <https://tc39.es/ecma262/#sec-terms-and-definitions-function>
///
/// In our implementation, Function is extending Object by holding an object field which some extra data
/// A Javascript function
#[derive(Trace, Finalize, Debug, Clone)]
pub enum Function {
/// A native javascript function
@ -32,7 +42,7 @@ pub enum Function {
RegularFunc(RegularFunction),
}
/// Represents a regular javascript function in memory
/// Represents a regular javascript function in memory.
#[derive(Trace, Finalize, Debug, Clone)]
pub struct RegularFunction {
/// The fields associated with the function

1
boa/src/builtins/mod.rs

@ -18,7 +18,6 @@ pub mod boolean;
pub mod console;
/// The global `Error` object
pub mod error;
/// The global `Function` object and function value representations
pub mod function;
pub mod json;
pub mod math;

Loading…
Cancel
Save