Skip to content

Commit

Permalink
Implemented requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
CalliEve committed Oct 8, 2022
1 parent a045735 commit 0e79248
Show file tree
Hide file tree
Showing 20 changed files with 52 additions and 50 deletions.
2 changes: 1 addition & 1 deletion boa_engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ mod tests;

/// A convenience module that re-exports the most commonly-used Boa APIs
pub mod prelude {
pub use crate::{object::js_object::JsObject, Context, JsBigInt, JsResult, JsString, JsValue};
pub use crate::{object::JsObject, Context, JsBigInt, JsResult, JsString, JsValue};
}

use std::result::Result as StdResult;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::ops::Deref;
/// # Examples
/// ```
/// # use boa_engine::{
/// # object::js_object::{JsArrayBuffer, JsDataView},
/// # object::builtins::{JsArrayBuffer, JsDataView},
/// # Context, JsValue
/// # };
///
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::ops::Deref;
/// Create a `JsMap` and set a new entry
/// ```
/// # use boa_engine::{
/// # object::js_object::JsMap,
/// # object::builtins::JsMap,
/// # Context, JsValue,
/// # };
///
Expand All @@ -37,7 +37,7 @@ use std::ops::Deref;
/// Create a `JsMap` from a `JsArray`
/// ```
/// # use boa_engine::{
/// # object::js_object::{JsArray, JsMap},
/// # object::builtins::{JsArray, JsMap},
/// # Context, JsValue,
/// # };
///
Expand Down Expand Up @@ -72,7 +72,7 @@ impl JsMap {
///
/// ```
/// # use boa_engine::{
/// # object::js_object::JsMap,
/// # object::builtins::JsMap,
/// # Context, JsValue,
/// # };
///
Expand All @@ -94,7 +94,7 @@ impl JsMap {
/// # Examples
/// ```
/// # use boa_engine::{
/// # object::js_object::{JsArray, JsMap},
/// # object::builtins::{JsArray, JsMap},
/// # Context, JsResult, JsValue,
/// # };
///
Expand Down Expand Up @@ -136,7 +136,7 @@ impl JsMap {
/// ```
/// # use boa_engine::{
/// # builtins::map::ordered_map::OrderedMap,
/// # object::{js_object::{JsObject, JsMap}, ObjectData},
/// # object::{builtins::JsMap, JsObject, ObjectData},
/// # Context, JsValue,
/// # };
///
Expand All @@ -156,7 +156,7 @@ impl JsMap {
/// Invalid Example - returns a `TypeError` with the message "object is not a Map"
/// ```
/// # use boa_engine::{
/// # object::js_object::{JsObject, JsArray, JsMap},
/// # object::{JsObject, builtins::{JsArray, JsMap}},
/// # Context, JsResult, JsValue,
/// # };
///
Expand Down Expand Up @@ -210,7 +210,7 @@ impl JsMap {
///
/// ```
/// # use boa_engine::{
/// # object::js_object::JsMap,
/// # object::builtins::JsMap,
/// # Context, JsValue,
/// # };
///
Expand Down Expand Up @@ -244,7 +244,7 @@ impl JsMap {
///
/// ```
/// # use boa_engine::{
/// # object::js_object::JsMap,
/// # object::builtins::JsMap,
/// # Context, JsValue,
/// # };
///
Expand All @@ -270,7 +270,7 @@ impl JsMap {
///
/// ```
/// # use boa_engine::{
/// # object::js_object::JsMap,
/// # object::builtins::JsMap,
/// # Context, JsValue,
/// # };
///
Expand Down Expand Up @@ -300,7 +300,7 @@ impl JsMap {
///
/// ```
/// # use boa_engine::{
/// # object::js_object::JsMap,
/// # object::builtins::JsMap,
/// # Context, JsValue,
/// # };
///
Expand All @@ -327,7 +327,7 @@ impl JsMap {
///
/// ```
/// # use boa_engine::{
/// # object::js_object::JsMap,
/// # object::builtins::JsMap,
/// # Context, JsValue,
/// # };
///
Expand All @@ -353,7 +353,7 @@ impl JsMap {
///
/// ```
/// # use boa_engine::{
/// # object::js_object::JsMap,
/// # object::builtins::JsMap,
/// # Context, JsValue,
/// # };
///
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ use boa_gc::{Finalize, Trace};

use crate::{
builtins::{function::NativeFunctionSignature, Proxy},
object::{FunctionBuilder, JsObject, JsObjectType, ObjectData},
Context, JsResult, JsValue,
};

use super::{FunctionBuilder, JsFunction, JsObject, JsObjectType, ObjectData};
use super::JsFunction;

/// JavaScript [`Proxy`][proxy] rust object.
///
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions boa_engine/src/object/builtins/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//! Contains all the Rust representations of JavaScript objects.
mod jsarray;
mod jsarraybuffer;
mod jsdataview;
mod jsfunction;
mod jsmap;
mod jsmap_iterator;
pub(crate) mod jsproxy;
mod jsset;
mod jsset_iterator;
mod jstypedarray;

pub use jsarray::*;
pub use jsarraybuffer::*;
pub use jsdataview::*;
pub use jsfunction::*;
pub use jsmap::*;
pub use jsmap_iterator::*;
pub use jsproxy::{JsProxy, JsRevocableProxy};
pub use jsset::*;
pub use jsset_iterator::*;
pub use jstypedarray::*;
34 changes: 6 additions & 28 deletions boa_engine/src/object/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! This module implements the Rust representation of a JavaScript object, see [js_object] for implementors.
//! This module implements the Rust representation of a JavaScript object, see object::[builtins] for implementors.
//!
//! This module also provides helper objects for working with JavaScript objects.
Expand Down Expand Up @@ -65,38 +65,16 @@ use std::{
mod tests;

pub(crate) mod internal_methods;
mod jsarray;
mod jsarraybuffer;
mod jsdataview;
mod jsfunction;
mod jsmap;
mod jsmap_iterator;

pub mod builtins;
mod jsobject;
mod jsproxy;
mod jsset;
mod jsset_iterator;
mod jstypedarray;
mod operations;
mod property_map;

pub mod js_object {
//! Contains all the Rust representations of JavaScript objects.
pub use super::jsarray::*;
pub use super::jsarraybuffer::*;
pub use super::jsdataview::*;
pub use super::jsfunction::*;
pub use super::jsmap::*;
pub use super::jsobject::JsObject;
pub use super::jsproxy::{JsProxy, JsRevocableProxy};
pub use super::jsset::*;
pub use super::jstypedarray::*;
}
pub(crate) use js_object::*;
pub(crate) use builtins::*;

pub use jsmap_iterator::*;
pub use jsproxy::JsProxyBuilder;
pub use jsset_iterator::*;
pub use builtins::jsproxy::JsProxyBuilder;
pub use jsobject::*;

pub(crate) trait JsObjectType:
Into<JsValue> + Into<JsObject> + Deref<Target = JsObject>
Expand Down
2 changes: 1 addition & 1 deletion boa_examples/src/bin/closures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// inside Rust and call them from Javascript.

use boa_engine::{
object::{js_object::JsObject, FunctionBuilder},
object::{FunctionBuilder, JsObject},
property::{Attribute, PropertyDescriptor},
Context, JsString, JsValue,
};
Expand Down
2 changes: 1 addition & 1 deletion boa_examples/src/bin/jsarray.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This example shows how to manipulate a Javascript array using Rust code.

use boa_engine::{
object::{js_object::JsArray, FunctionBuilder},
object::{builtins::JsArray, FunctionBuilder},
Context, JsResult, JsValue,
};

Expand Down
2 changes: 1 addition & 1 deletion boa_examples/src/bin/jsarraybuffer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This example shows how to manipulate a Javascript array using Rust code.

use boa_engine::{
object::js_object::{JsArrayBuffer, JsDataView, JsUint32Array, JsUint8Array},
object::builtins::{JsArrayBuffer, JsDataView, JsUint32Array, JsUint8Array},
property::Attribute,
Context, JsResult, JsValue,
};
Expand Down
2 changes: 1 addition & 1 deletion boa_examples/src/bin/jsmap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use boa_engine::{
object::{js_object::JsArray, js_object::JsMap},
object::{builtins::JsArray, builtins::JsMap},
Context, JsResult, JsValue,
};

Expand Down
2 changes: 1 addition & 1 deletion boa_examples/src/bin/jsset.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This example shows how to manipulate a Javascript Set using Rust code.
#![allow(clippy::bool_assert_comparison)]
use boa_engine::{object::js_object::JsSet, Context, JsValue};
use boa_engine::{object::builtins::JsSet, Context, JsValue};

fn main() -> Result<(), JsValue> {
// New `Context` for a new Javascript executor.
Expand Down
2 changes: 1 addition & 1 deletion boa_examples/src/bin/jstypedarray.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This example shows how to manipulate a Javascript array using Rust code.

use boa_engine::{
object::{js_object::JsUint8Array, FunctionBuilder},
object::{builtins::JsUint8Array, FunctionBuilder},
property::Attribute,
Context, JsResult, JsValue,
};
Expand Down
2 changes: 1 addition & 1 deletion boa_tester/src/exec/js262.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use boa_engine::{
builtins::JsArgs,
object::{js_object::JsObject, ObjectInitializer},
object::{JsObject, ObjectInitializer},
property::Attribute,
Context, JsResult, JsValue,
};
Expand Down

0 comments on commit 0e79248

Please sign in to comment.