Skip to content

Commit

Permalink
Merge 868a985 into be20b65
Browse files Browse the repository at this point in the history
  • Loading branch information
HalidOdat committed Sep 2, 2020
2 parents be20b65 + 868a985 commit d4d7b9f
Show file tree
Hide file tree
Showing 73 changed files with 97 additions and 161 deletions.
5 changes: 2 additions & 3 deletions boa/examples/classes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ use boa::{
builtins::{
object::{Class, ClassBuilder},
property::Attribute,
value::Value,
},
exec::Interpreter,
forward_val,
realm::Realm,
Result,
Result, Value,
};

use gc::{Finalize, Trace};
Expand Down Expand Up @@ -140,7 +139,7 @@ fn main() {
if (!Person.is('Hello')) {
console.log('\'Hello\' string is not a Person class instance.');
}
console.log(Person.staticProperty);
console.log(person.inheritedProperty);
console.log(Person.prototype.inheritedProperty === person.inheritedProperty);
Expand Down
2 changes: 1 addition & 1 deletion boa/src/builtins/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ use crate::{
builtins::{
object::{ObjectData, PROTOTYPE},
property::{Attribute, Property},
value::{same_value_zero, Value},
},
exec::Interpreter,
value::{same_value_zero, Value},
BoaProfiler, Result,
};
use std::{
Expand Down
5 changes: 1 addition & 4 deletions boa/src/builtins/bigint/conversions.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use super::BigInt;

use crate::{
builtins::{Number, Value},
exec::Interpreter,
};
use crate::{builtins::Number, exec::Interpreter, Value};
use num_traits::cast::{FromPrimitive, ToPrimitive};

use std::convert::TryFrom;
Expand Down
2 changes: 1 addition & 1 deletion boa/src/builtins/bigint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ use crate::{
builtins::{
function::{make_builtin_fn, make_constructor_fn},
object::ObjectData,
value::{RcBigInt, Value},
},
exec::Interpreter,
value::{RcBigInt, Value},
BoaProfiler, Result,
};

Expand Down
6 changes: 1 addition & 5 deletions boa/src/builtins/boolean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@
mod tests;

use super::function::{make_builtin_fn, make_constructor_fn};
use crate::{
builtins::{object::ObjectData, value::Value},
exec::Interpreter,
BoaProfiler, Result,
};
use crate::{builtins::object::ObjectData, exec::Interpreter, BoaProfiler, Result, Value};

/// Boolean implementation.
#[derive(Debug, Clone, Copy)]
Expand Down
2 changes: 1 addition & 1 deletion boa/src/builtins/boolean/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{builtins::value::same_value, exec::Interpreter, forward, forward_val, realm::Realm};
use crate::{exec::Interpreter, forward, forward_val, realm::Realm, value::same_value};

/// Test the correct type is returned from call and construct
#[allow(clippy::unwrap_used)]
Expand Down
6 changes: 2 additions & 4 deletions boa/src/builtins/console/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
mod tests;

use crate::{
builtins::{
function::make_builtin_fn,
value::{display_obj, RcString, Value},
},
builtins::function::make_builtin_fn,
exec::Interpreter,
value::{display_obj, RcString, Value},
BoaProfiler, Result,
};
use rustc_hash::FxHashMap;
Expand Down
6 changes: 1 addition & 5 deletions boa/src/builtins/console/tests.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use crate::{
builtins::{console::formatter, value::Value},
exec::Interpreter,
realm::Realm,
};
use crate::{builtins::console::formatter, exec::Interpreter, realm::Realm, Value};

#[test]
fn formatter_no_args_is_empty_string() {
Expand Down
5 changes: 2 additions & 3 deletions boa/src/builtins/date/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ use crate::{
builtins::{
function::{make_builtin_fn, make_constructor_fn},
object::ObjectData,
value::PreferredType,
Value,
},
BoaProfiler, Interpreter, Result,
value::PreferredType,
BoaProfiler, Interpreter, Result, Value,
};
use chrono::{prelude::*, Duration, LocalResult};
use gc::{unsafe_empty_trace, Finalize, Trace};
Expand Down
5 changes: 1 addition & 4 deletions boa/src/builtins/date/tests.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#![allow(clippy::zero_prefixed_literal)]

use crate::{
builtins::{object::ObjectData, Value},
forward, forward_val, Interpreter, Realm,
};
use crate::{builtins::object::ObjectData, forward, forward_val, Interpreter, Realm, Value};
use chrono::prelude::*;

// NOTE: Javascript Uses 0-based months, where chrono uses 1-based months. Many of the assertions look wrong because of
Expand Down
3 changes: 1 addition & 2 deletions boa/src/builtins/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ use crate::{
builtins::{
function::{make_builtin_fn, make_constructor_fn},
object::ObjectData,
value::Value,
},
exec::Interpreter,
profiler::BoaProfiler,
Result,
Result, Value,
};

pub(crate) mod range;
Expand Down
6 changes: 2 additions & 4 deletions boa/src/builtins/error/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError

use crate::{
builtins::{
function::make_builtin_fn, function::make_constructor_fn, object::ObjectData, value::Value,
},
builtins::{function::make_builtin_fn, function::make_constructor_fn, object::ObjectData},
exec::Interpreter,
profiler::BoaProfiler,
Result,
Result, Value,
};

/// JavaScript `RangeError` impleentation.
Expand Down
6 changes: 2 additions & 4 deletions boa/src/builtins/error/reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError

use crate::{
builtins::{
function::make_builtin_fn, function::make_constructor_fn, object::ObjectData, value::Value,
},
builtins::{function::make_builtin_fn, function::make_constructor_fn, object::ObjectData},
exec::Interpreter,
profiler::BoaProfiler,
Result,
Result, Value,
};

#[derive(Debug, Clone, Copy)]
Expand Down
6 changes: 2 additions & 4 deletions boa/src/builtins/error/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError

use crate::{
builtins::{
function::make_builtin_fn, function::make_constructor_fn, object::ObjectData, value::Value,
},
builtins::{function::make_builtin_fn, function::make_constructor_fn, object::ObjectData},
exec::Interpreter,
profiler::BoaProfiler,
Result,
Result, Value,
};

/// JavaScript `SyntaxError` impleentation.
Expand Down
6 changes: 2 additions & 4 deletions boa/src/builtins/error/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError

use crate::{
builtins::{
function::make_builtin_fn, function::make_constructor_fn, object::ObjectData, value::Value,
},
builtins::{function::make_builtin_fn, function::make_constructor_fn, object::ObjectData},
exec::Interpreter,
BoaProfiler, Result,
BoaProfiler, Result, Value,
};

/// JavaScript `TypeError` implementation.
Expand Down
3 changes: 1 addition & 2 deletions boa/src/builtins/function/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ use crate::{
builtins::{
object::{Object, ObjectData, PROTOTYPE},
property::{Attribute, Property},
value::Value,
Array,
},
environment::lexical_environment::Environment,
exec::Interpreter,
syntax::ast::node::{FormalParameter, StatementList},
BoaProfiler, Result,
BoaProfiler, Result, Value,
};
use bitflags::bitflags;
use gc::{unsafe_empty_trace, Finalize, Trace};
Expand Down
2 changes: 1 addition & 1 deletion boa/src/builtins/global_this/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! [spec]: https://tc39.es/ecma262/#sec-globalthis
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis

use crate::{builtins::value::Value, BoaProfiler, Interpreter};
use crate::{BoaProfiler, Interpreter, Value};

#[cfg(test)]
mod tests;
Expand Down
2 changes: 1 addition & 1 deletion boa/src/builtins/infinity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#[cfg(test)]
mod tests;

use crate::{builtins::value::Value, BoaProfiler, Interpreter};
use crate::{BoaProfiler, Interpreter, Value};

/// JavaScript global `Infinity` property.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
Expand Down
3 changes: 1 addition & 2 deletions boa/src/builtins/json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ use crate::{
builtins::{
function::make_builtin_fn,
property::{Property, PropertyKey},
value::Value,
},
exec::Interpreter,
BoaProfiler, Result,
BoaProfiler, Result, Value,
};
use serde_json::{self, Value as JSONValue};

Expand Down
6 changes: 2 additions & 4 deletions boa/src/builtins/json/tests.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::{
builtins::{object::PROTOTYPE, value::same_value},
exec::Interpreter,
forward, forward_val,
realm::Realm,
builtins::object::PROTOTYPE, exec::Interpreter, forward, forward_val, realm::Realm,
value::same_value,
};

#[test]
Expand Down
3 changes: 1 addition & 2 deletions boa/src/builtins/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ use crate::{
builtins::{
object::{ObjectData, PROTOTYPE},
property::{Attribute, Property},
value::Value,
},
exec::Interpreter,
BoaProfiler, Result,
BoaProfiler, Result, Value,
};
use ordered_map::OrderedMap;

Expand Down
6 changes: 1 addition & 5 deletions boa/src/builtins/math/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
//! [spec]: https://tc39.es/ecma262/#sec-math-object
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math

use crate::{
builtins::{function::make_builtin_fn, value::Value},
exec::Interpreter,
BoaProfiler, Result,
};
use crate::{builtins::function::make_builtin_fn, exec::Interpreter, BoaProfiler, Result, Value};
use std::f64;

#[cfg(test)]
Expand Down
4 changes: 1 addition & 3 deletions boa/src/builtins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub mod regexp;
pub mod string;
pub mod symbol;
pub mod undefined;
pub mod value;

pub(crate) use self::{
array::Array,
Expand All @@ -40,9 +39,8 @@ pub(crate) use self::{
string::String,
symbol::Symbol,
undefined::Undefined,
value::Value,
};
use crate::Interpreter;
use crate::{Interpreter, Value};

/// Initializes builtin objects and functions
#[inline]
Expand Down
2 changes: 1 addition & 1 deletion boa/src/builtins/nan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#[cfg(test)]
mod tests;

use crate::{builtins::value::Value, BoaProfiler, Interpreter};
use crate::{BoaProfiler, Interpreter, Value};

/// JavaScript global `NaN` property.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
Expand Down
3 changes: 1 addition & 2 deletions boa/src/builtins/number/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
use super::{
function::{make_builtin_fn, make_constructor_fn},
object::ObjectData,
value::AbstractRelation,
};
use crate::{builtins::value::Value, exec::Interpreter, BoaProfiler, Result};
use crate::{exec::Interpreter, value::AbstractRelation, BoaProfiler, Result, Value};
use num_traits::float::FloatCore;

mod conversions;
Expand Down
7 changes: 2 additions & 5 deletions boa/src/builtins/object/gcobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@

use super::{Object, PROTOTYPE};
use crate::{
builtins::{
function::{create_unmapped_arguments_object, BuiltInFunction, Function},
Value,
},
builtins::function::{create_unmapped_arguments_object, BuiltInFunction, Function},
environment::{
function_environment_record::BindingStatus, lexical_environment::new_function_environment,
},
Executable, Interpreter, Result,
Executable, Interpreter, Result, Value,
};
use gc::{Finalize, Gc, GcCell, GcCellRef, GcCellRefMut, Trace};
use std::{
Expand Down
11 changes: 6 additions & 5 deletions boa/src/builtins/object/internal_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
//!
//! [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots

use crate::builtins::{
object::Object,
property::{Attribute, Property, PropertyKey},
use crate::{
builtins::{
object::Object,
property::{Attribute, Property, PropertyKey},
},
value::{same_value, Value},
BoaProfiler,
};
use crate::BoaProfiler;

impl Object {
/// Check if object has property.
///
Expand Down
3 changes: 2 additions & 1 deletion boa/src/builtins/object/iter.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::{Object, Property, PropertyKey, RcString, RcSymbol};
use super::{Object, Property, PropertyKey};
use crate::value::{RcString, RcSymbol};
use std::{collections::hash_map, iter::FusedIterator};

impl Object {
Expand Down
4 changes: 2 additions & 2 deletions boa/src/builtins/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ use crate::{
function::Function,
map::ordered_map::OrderedMap,
property::{Attribute, Property, PropertyKey},
value::{RcBigInt, RcString, RcSymbol, Value},
BigInt, Date, RegExp,
},
exec::Interpreter,
value::{RcBigInt, RcString, RcSymbol, Value},
BoaProfiler, Result,
};
use gc::{Finalize, Trace};
Expand All @@ -33,7 +33,7 @@ use std::result::Result as StdResult;
use super::function::{
make_builtin_fn, make_constructor_fn, BuiltInFunction, FunctionFlags, NativeFunction,
};
use crate::builtins::value::same_value;
use crate::value::same_value;

mod gcobject;
mod internal_methods;
Expand Down
4 changes: 1 addition & 3 deletions boa/src/builtins/property/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
//! [section]: https://tc39.es/ecma262/#sec-property-attributes

use crate::builtins::value::RcString;
use crate::builtins::value::RcSymbol;
use crate::builtins::Value;
use crate::value::{RcString, RcSymbol, Value};
use gc::{Finalize, Trace};
use std::convert::TryFrom;
use std::fmt;
Expand Down
Loading

0 comments on commit d4d7b9f

Please sign in to comment.