Browse Source

Move value module from builtins (#674)

pull/684/head
Halid Odat 4 years ago committed by GitHub
parent
commit
59d328e67c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      boa/examples/classes.rs
  2. 2
      boa/src/builtins/array/mod.rs
  3. 5
      boa/src/builtins/bigint/conversions.rs
  4. 2
      boa/src/builtins/bigint/mod.rs
  5. 6
      boa/src/builtins/boolean/mod.rs
  6. 2
      boa/src/builtins/boolean/tests.rs
  7. 6
      boa/src/builtins/console/mod.rs
  8. 6
      boa/src/builtins/console/tests.rs
  9. 5
      boa/src/builtins/date/mod.rs
  10. 5
      boa/src/builtins/date/tests.rs
  11. 3
      boa/src/builtins/error/mod.rs
  12. 6
      boa/src/builtins/error/range.rs
  13. 6
      boa/src/builtins/error/reference.rs
  14. 6
      boa/src/builtins/error/syntax.rs
  15. 6
      boa/src/builtins/error/type.rs
  16. 5
      boa/src/builtins/function/mod.rs
  17. 2
      boa/src/builtins/global_this/mod.rs
  18. 2
      boa/src/builtins/infinity/mod.rs
  19. 3
      boa/src/builtins/json/mod.rs
  20. 6
      boa/src/builtins/json/tests.rs
  21. 3
      boa/src/builtins/map/mod.rs
  22. 6
      boa/src/builtins/math/mod.rs
  23. 4
      boa/src/builtins/mod.rs
  24. 2
      boa/src/builtins/nan/mod.rs
  25. 3
      boa/src/builtins/number/mod.rs
  26. 9
      boa/src/builtins/object/gcobject.rs
  27. 7
      boa/src/builtins/object/internal_methods.rs
  28. 3
      boa/src/builtins/object/iter.rs
  29. 7
      boa/src/builtins/object/mod.rs
  30. 4
      boa/src/builtins/property/mod.rs
  31. 7
      boa/src/builtins/regexp/mod.rs
  32. 2
      boa/src/builtins/string/mod.rs
  33. 6
      boa/src/builtins/symbol/mod.rs
  34. 2
      boa/src/builtins/undefined/mod.rs
  35. 7
      boa/src/class.rs
  36. 2
      boa/src/environment/declarative_environment_record.rs
  37. 2
      boa/src/environment/environment_record_trait.rs
  38. 3
      boa/src/environment/function_environment_record.rs
  39. 6
      boa/src/environment/global_environment_record.rs
  40. 4
      boa/src/environment/lexical_environment.rs
  41. 6
      boa/src/environment/object_environment_record.rs
  42. 4
      boa/src/exec/array/mod.rs
  43. 4
      boa/src/exec/block/mod.rs
  44. 3
      boa/src/exec/break_node/mod.rs
  45. 2
      boa/src/exec/call/mod.rs
  46. 3
      boa/src/exec/conditional/mod.rs
  47. 4
      boa/src/exec/declaration/mod.rs
  48. 2
      boa/src/exec/field/mod.rs
  49. 2
      boa/src/exec/identifier/mod.rs
  50. 3
      boa/src/exec/iteration/mod.rs
  51. 2
      boa/src/exec/mod.rs
  52. 2
      boa/src/exec/new/mod.rs
  53. 3
      boa/src/exec/object/mod.rs
  54. 3
      boa/src/exec/operator/mod.rs
  55. 2
      boa/src/exec/return_smt/mod.rs
  56. 2
      boa/src/exec/spread/mod.rs
  57. 2
      boa/src/exec/statement_list.rs
  58. 2
      boa/src/exec/switch/mod.rs
  59. 8
      boa/src/exec/tests.rs
  60. 2
      boa/src/exec/throw/mod.rs
  61. 3
      boa/src/exec/try_node/mod.rs
  62. 4
      boa/src/lib.rs
  63. 3
      boa/src/realm.rs
  64. 0
      boa/src/value/conversions.rs
  65. 0
      boa/src/value/display.rs
  66. 0
      boa/src/value/equality.rs
  67. 0
      boa/src/value/hash.rs
  68. 4
      boa/src/value/mod.rs
  69. 5
      boa/src/value/operations.rs
  70. 0
      boa/src/value/rcbigint.rs
  71. 0
      boa/src/value/rcstring.rs
  72. 0
      boa/src/value/rcsymbol.rs
  73. 0
      boa/src/value/tests.rs
  74. 0
      boa/src/value/type.rs

4
boa/examples/classes.rs

@ -1,10 +1,10 @@
use boa::{
builtins::{property::Attribute, value::Value},
builtins::property::Attribute,
class::{Class, ClassBuilder},
exec::Interpreter,
forward_val,
realm::Realm,
Finalize, Result, Trace,
Finalize, Result, Trace, Value,
};
// We create a new struct that is going to represent a person.

2
boa/src/builtins/array/mod.rs

@ -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::{

5
boa/src/builtins/bigint/conversions.rs

@ -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;

2
boa/src/builtins/bigint/mod.rs

@ -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,
};

6
boa/src/builtins/boolean/mod.rs

@ -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)]

2
boa/src/builtins/boolean/tests.rs

@ -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)]

6
boa/src/builtins/console/mod.rs

@ -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;

6
boa/src/builtins/console/tests.rs

@ -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() {

5
boa/src/builtins/date/mod.rs

@ -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};

5
boa/src/builtins/date/tests.rs

@ -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

3
boa/src/builtins/error/mod.rs

@ -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;

6
boa/src/builtins/error/range.rs

@ -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.

6
boa/src/builtins/error/reference.rs

@ -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)]

6
boa/src/builtins/error/syntax.rs

@ -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.

6
boa/src/builtins/error/type.rs

@ -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.

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

@ -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, RcStatementList},
BoaProfiler, Result,
syntax::ast::node::{statement_list::RcStatementList, FormalParameter},
BoaProfiler, Result, Value,
};
use bitflags::bitflags;
use gc::{unsafe_empty_trace, Finalize, Trace};

2
boa/src/builtins/global_this/mod.rs

@ -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;

2
boa/src/builtins/infinity/mod.rs

@ -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)]

3
boa/src/builtins/json/mod.rs

@ -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};

6
boa/src/builtins/json/tests.rs

@ -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]

3
boa/src/builtins/map/mod.rs

@ -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;

6
boa/src/builtins/math/mod.rs

@ -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)]

4
boa/src/builtins/mod.rs

@ -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,
@ -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]

2
boa/src/builtins/nan/mod.rs

@ -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)]

3
boa/src/builtins/number/mod.rs

@ -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;

9
boa/src/builtins/object/gcobject.rs

@ -4,15 +4,14 @@
use super::{Object, PROTOTYPE};
use crate::{
builtins::{
function::{create_unmapped_arguments_object, BuiltInFunction, Function, NativeFunction},
Value,
builtins::function::{
create_unmapped_arguments_object, BuiltInFunction, Function, NativeFunction,
},
environment::{
function_environment_record::BindingStatus, lexical_environment::new_function_environment,
},
syntax::ast::node::statement_list::RcStatementList,
Executable, Interpreter, Result,
syntax::ast::node::RcStatementList,
Executable, Interpreter, Result, Value,
};
use gc::{Finalize, Gc, GcCell, GcCellRef, GcCellRefMut, Trace};
use std::{

7
boa/src/builtins/object/internal_methods.rs

@ -5,13 +5,14 @@
//!
//! [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots
use crate::builtins::{
use crate::{
builtins::{
object::Object,
property::{Attribute, Property, PropertyKey},
},
value::{same_value, Value},
BoaProfiler,
};
use crate::BoaProfiler;
impl Object {
/// Check if object has property.
///

3
boa/src/builtins/object/iter.rs

@ -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 {

7
boa/src/builtins/object/mod.rs

@ -15,13 +15,13 @@
use crate::{
builtins::{
function::Function,
function::{make_builtin_fn, make_constructor_fn, Function},
map::ordered_map::OrderedMap,
property::{Property, PropertyKey},
value::{RcBigInt, RcString, RcSymbol, Value},
BigInt, Date, RegExp,
},
exec::Interpreter,
value::{same_value, RcBigInt, RcString, RcSymbol, Value},
BoaProfiler, Result,
};
use gc::{Finalize, Trace};
@ -29,9 +29,6 @@ use rustc_hash::FxHashMap;
use std::fmt::{Debug, Display, Error, Formatter};
use std::{any::Any, result::Result as StdResult};
use super::function::{make_builtin_fn, make_constructor_fn};
use crate::builtins::value::same_value;
mod gcobject;
mod internal_methods;
mod iter;

4
boa/src/builtins/property/mod.rs

@ -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;

7
boa/src/builtins/regexp/mod.rs

@ -13,12 +13,9 @@ use regex::Regex;
use super::function::{make_builtin_fn, make_constructor_fn};
use crate::{
builtins::{
object::ObjectData,
property::Property,
value::{RcString, Value},
},
builtins::{object::ObjectData, property::Property},
exec::Interpreter,
value::{RcString, Value},
BoaProfiler, Result,
};
use gc::{unsafe_empty_trace, Finalize, Trace};

2
boa/src/builtins/string/mod.rs

@ -17,10 +17,10 @@ use crate::{
builtins::{
object::{Object, ObjectData},
property::Property,
value::{RcString, Value},
RegExp,
},
exec::Interpreter,
value::{RcString, Value},
BoaProfiler, Result,
};
use regex::Regex;

6
boa/src/builtins/symbol/mod.rs

@ -20,11 +20,9 @@ mod tests;
use super::function::{make_builtin_fn, make_constructor_fn};
use crate::{
builtins::{
property::{Attribute, Property},
value::{RcString, RcSymbol, Value},
},
builtins::property::{Attribute, Property},
exec::Interpreter,
value::{RcString, RcSymbol, Value},
BoaProfiler, Result,
};
use gc::{Finalize, Trace};

2
boa/src/builtins/undefined/mod.rs

@ -12,7 +12,7 @@
#[cfg(test)]
mod tests;
use crate::{builtins::value::Value, BoaProfiler, Interpreter};
use crate::{BoaProfiler, Interpreter, Value};
/// JavaScript global `undefined` property.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]

7
boa/src/class.rs

@ -3,12 +3,12 @@
//! Native classes are implemented through the [`Class`][class-trait] trait.
//! ```
//!# use boa::{
//!# builtins::{property::Attribute, value::Value},
//!# builtins::property::Attribute,
//!# class::{Class, ClassBuilder},
//!# exec::Interpreter,
//!# forward_val,
//!# realm::Realm,
//!# Finalize, Result, Trace,
//!# Finalize, Value, Result, Trace,
//!# };
//!#
//! // This does not have to be an enum it can also be a struct.
@ -67,9 +67,8 @@ use crate::{
function::{BuiltInFunction, Function, FunctionFlags, NativeFunction},
object::{GcObject, NativeObject, Object, ObjectData, PROTOTYPE},
property::{Attribute, Property, PropertyKey},
Value,
},
Interpreter, Result,
Interpreter, Result, Value,
};
use std::fmt::Debug;

2
boa/src/environment/declarative_environment_record.rs

@ -6,11 +6,11 @@
//! More info: [ECMA-262 sec-declarative-environment-records](https://tc39.es/ecma262/#sec-declarative-environment-records)
use crate::{
builtins::value::Value,
environment::{
environment_record_trait::EnvironmentRecordTrait,
lexical_environment::{Environment, EnvironmentType},
},
Value,
};
use gc::{Finalize, Trace};
use rustc_hash::FxHashMap;

2
boa/src/environment/environment_record_trait.rs

@ -9,8 +9,8 @@
//! There are 5 Environment record kinds. They all have methods in common, these are implemented as a the `EnvironmentRecordTrait`
//!
use crate::{
builtins::value::Value,
environment::lexical_environment::{Environment, EnvironmentType},
Value,
};
use gc::{Finalize, Trace};
use std::fmt::Debug;

3
boa/src/environment/function_environment_record.rs

@ -9,12 +9,13 @@
//! More info: <https://tc39.es/ecma262/#sec-function-environment-records>
use crate::{
builtins::{object::GcObject, value::Value},
builtins::object::GcObject,
environment::{
declarative_environment_record::DeclarativeEnvironmentRecordBinding,
environment_record_trait::EnvironmentRecordTrait,
lexical_environment::{Environment, EnvironmentType},
},
Value,
};
use gc::{unsafe_empty_trace, Finalize, Trace};
use rustc_hash::FxHashMap;

6
boa/src/environment/global_environment_record.rs

@ -8,16 +8,14 @@
//! More info: <https://tc39.es/ecma262/#sec-global-environment-records>
use crate::{
builtins::{
property::{Attribute, Property},
Value,
},
builtins::property::{Attribute, Property},
environment::{
declarative_environment_record::DeclarativeEnvironmentRecord,
environment_record_trait::EnvironmentRecordTrait,
lexical_environment::{Environment, EnvironmentType},
object_environment_record::ObjectEnvironmentRecord,
},
Value,
};
use gc::{Finalize, Trace};
use rustc_hash::FxHashSet;

4
boa/src/environment/lexical_environment.rs

@ -6,7 +6,7 @@
//! This is the entrypoint to lexical environments.
use crate::{
builtins::{object::GcObject, value::Value},
builtins::object::GcObject,
environment::{
declarative_environment_record::DeclarativeEnvironmentRecord,
environment_record_trait::EnvironmentRecordTrait,
@ -14,7 +14,7 @@ use crate::{
global_environment_record::GlobalEnvironmentRecord,
object_environment_record::ObjectEnvironmentRecord,
},
BoaProfiler,
BoaProfiler, Value,
};
use gc::{Gc, GcCell};
use rustc_hash::{FxHashMap, FxHashSet};

6
boa/src/environment/object_environment_record.rs

@ -7,14 +7,12 @@
//! More info: [Object Records](https://tc39.es/ecma262/#sec-object-environment-records)
use crate::{
builtins::{
property::{Attribute, Property},
value::Value,
},
builtins::property::{Attribute, Property},
environment::{
environment_record_trait::EnvironmentRecordTrait,
lexical_environment::{Environment, EnvironmentType},
},
Value,
};
use gc::{Finalize, Trace};

4
boa/src/exec/array/mod.rs

@ -2,9 +2,9 @@
use super::{Executable, Interpreter};
use crate::{
builtins::{Array, Value},
builtins::Array,
syntax::ast::node::{ArrayDecl, Node},
BoaProfiler, Result,
BoaProfiler, Result, Value,
};
impl Executable for ArrayDecl {

4
boa/src/exec/block/mod.rs

@ -2,8 +2,8 @@
use super::{Executable, Interpreter, InterpreterState};
use crate::{
builtins::value::Value, environment::lexical_environment::new_declarative_environment,
syntax::ast::node::Block, BoaProfiler, Result,
environment::lexical_environment::new_declarative_environment, syntax::ast::node::Block,
BoaProfiler, Result, Value,
};
impl Executable for Block {

3
boa/src/exec/break_node/mod.rs

@ -1,8 +1,7 @@
use super::{Executable, Interpreter, InterpreterState};
use crate::{
builtins::value::Value,
syntax::ast::node::{Break, Continue},
Result,
Result, Value,
};
#[cfg(test)]

2
boa/src/exec/call/mod.rs

@ -1,7 +1,7 @@
use super::{Executable, Interpreter, InterpreterState};
use crate::{
builtins::value::{Type, Value},
syntax::ast::node::{Call, Node},
value::{Type, Value},
BoaProfiler, Result,
};

3
boa/src/exec/conditional/mod.rs

@ -1,8 +1,7 @@
use super::{Executable, Interpreter};
use crate::{
builtins::Value,
syntax::ast::node::{ConditionalOp, If},
Result,
Result, Value,
};
use std::borrow::Borrow;

4
boa/src/exec/declaration/mod.rs

@ -2,12 +2,12 @@
use super::{Executable, Interpreter};
use crate::{
builtins::{function::FunctionFlags, Value},
builtins::function::FunctionFlags,
environment::lexical_environment::VariableScope,
syntax::ast::node::{
ArrowFunctionDecl, ConstDeclList, FunctionDecl, FunctionExpr, LetDeclList, VarDeclList,
},
BoaProfiler, Result,
BoaProfiler, Result, Value,
};
impl Executable for FunctionDecl {

2
boa/src/exec/field/mod.rs

@ -1,7 +1,7 @@
use super::{Executable, Interpreter};
use crate::{
builtins::value::{Type, Value},
syntax::ast::node::{GetConstField, GetField},
value::{Type, Value},
Result,
};

2
boa/src/exec/identifier/mod.rs

@ -1,5 +1,5 @@
use super::{Executable, Interpreter};
use crate::{builtins::value::Value, syntax::ast::node::identifier::Identifier, Result};
use crate::{syntax::ast::node::identifier::Identifier, Result, Value};
impl Executable for Identifier {
fn run(&self, interpreter: &mut Interpreter) -> Result<Value> {

3
boa/src/exec/iteration/mod.rs

@ -2,10 +2,9 @@
use super::{Executable, Interpreter, InterpreterState};
use crate::{
builtins::value::Value,
environment::lexical_environment::new_declarative_environment,
syntax::ast::node::{DoWhileLoop, ForLoop, WhileLoop},
BoaProfiler, Result,
BoaProfiler, Result, Value,
};
use std::borrow::Borrow;

2
boa/src/exec/mod.rs

@ -28,7 +28,6 @@ use crate::{
function::{Function, FunctionFlags, NativeFunction},
object::{GcObject, Object, ObjectData, PROTOTYPE},
property::{Property, PropertyKey},
value::{PreferredType, RcString, RcSymbol, Type, Value},
Console, Symbol,
},
class::{Class, ClassBuilder},
@ -37,6 +36,7 @@ use crate::{
constant::Const,
node::{FormalParameter, Node, RcStatementList, StatementList},
},
value::{PreferredType, RcString, RcSymbol, Type, Value},
BoaProfiler, Result,
};
use std::result::Result as StdResult;

2
boa/src/exec/new/mod.rs

@ -1,5 +1,5 @@
use super::{Executable, Interpreter};
use crate::{builtins::Value, syntax::ast::node::New, BoaProfiler, Result};
use crate::{syntax::ast::node::New, BoaProfiler, Result, Value};
impl Executable for New {
fn run(&self, interpreter: &mut Interpreter) -> Result<Value> {

3
boa/src/exec/object/mod.rs

@ -2,10 +2,9 @@
use super::{Executable, Interpreter};
use crate::{
builtins::value::Value,
syntax::ast::node::MethodDefinitionKind,
syntax::ast::node::{Object, PropertyDefinition},
Result,
Result, Value,
};
use std::borrow::Borrow;

3
boa/src/exec/operator/mod.rs

@ -4,13 +4,12 @@ mod tests;
use super::{Executable, Interpreter};
use crate::{
builtins::value::Value,
environment::lexical_environment::VariableScope,
syntax::ast::{
node::{Assign, BinOp, Node, UnaryOp},
op::{self, AssignOp, BitOp, CompOp, LogOp, NumOp},
},
BoaProfiler, Result,
BoaProfiler, Result, Value,
};
impl Executable for Assign {

2
boa/src/exec/return_smt/mod.rs

@ -1,5 +1,5 @@
use super::{Executable, Interpreter, InterpreterState};
use crate::{builtins::value::Value, syntax::ast::node::Return, Result};
use crate::{syntax::ast::node::Return, Result, Value};
impl Executable for Return {
fn run(&self, interpreter: &mut Interpreter) -> Result<Value> {

2
boa/src/exec/spread/mod.rs

@ -1,5 +1,5 @@
use super::{Executable, Interpreter};
use crate::{builtins::value::Value, syntax::ast::node::Spread, Result};
use crate::{syntax::ast::node::Spread, Result, Value};
impl Executable for Spread {
fn run(&self, interpreter: &mut Interpreter) -> Result<Value> {

2
boa/src/exec/statement_list.rs

@ -1,7 +1,7 @@
//! Statement list execution.
use super::{Executable, Interpreter, InterpreterState};
use crate::{builtins::value::Value, syntax::ast::node::StatementList, BoaProfiler, Result};
use crate::{syntax::ast::node::StatementList, BoaProfiler, Result, Value};
impl Executable for StatementList {
fn run(&self, interpreter: &mut Interpreter) -> Result<Value> {

2
boa/src/exec/switch/mod.rs

@ -1,5 +1,5 @@
use super::{Executable, Interpreter, InterpreterState};
use crate::{builtins::value::Value, syntax::ast::node::Switch, Result};
use crate::{syntax::ast::node::Switch, Result, Value};
#[cfg(test)]
mod tests;

8
boa/src/exec/tests.rs

@ -1,10 +1,4 @@
use crate::{
builtins::{Number, Value},
exec,
exec::Interpreter,
forward, forward_val,
realm::Realm,
};
use crate::{builtins::Number, exec, exec::Interpreter, forward, forward_val, realm::Realm, Value};
#[test]
fn function_declaration_returns_undefined() {

2
boa/src/exec/throw/mod.rs

@ -1,5 +1,5 @@
use super::{Executable, Interpreter};
use crate::{builtins::value::Value, syntax::ast::node::Throw, Result};
use crate::{syntax::ast::node::Throw, Result, Value};
impl Executable for Throw {
#[inline]

3
boa/src/exec/try_node/mod.rs

@ -2,10 +2,9 @@
use super::{Executable, Interpreter};
use crate::{
builtins::value::Value,
environment::lexical_environment::{new_declarative_environment, VariableScope},
syntax::ast::node::Try,
BoaProfiler, Result,
BoaProfiler, Result, Value,
};
#[cfg(test)]

4
boa/src/lib.rs

@ -41,8 +41,9 @@ pub mod exec;
pub mod profiler;
pub mod realm;
pub mod syntax;
pub mod value;
use crate::{builtins::value::Value, syntax::ast::node::StatementList};
use crate::syntax::ast::node::StatementList;
pub use crate::{
exec::{Executable, Interpreter},
profiler::BoaProfiler,
@ -51,6 +52,7 @@ pub use crate::{
lexer::Lexer,
parser::{ParseError, Parser},
},
value::Value,
};
use std::result::Result as StdResult;

3
boa/src/realm.rs

@ -5,14 +5,13 @@
//! A realm is represented in this implementation as a Realm struct with the fields specified from the spec.
use crate::{
builtins::value::Value,
environment::{
declarative_environment_record::DeclarativeEnvironmentRecord,
global_environment_record::GlobalEnvironmentRecord,
lexical_environment::LexicalEnvironment,
object_environment_record::ObjectEnvironmentRecord,
},
BoaProfiler,
BoaProfiler, Value,
};
use gc::{Gc, GcCell};
use rustc_hash::{FxHashMap, FxHashSet};

0
boa/src/builtins/value/conversions.rs → boa/src/value/conversions.rs

0
boa/src/builtins/value/display.rs → boa/src/value/display.rs

0
boa/src/builtins/value/equality.rs → boa/src/value/equality.rs

0
boa/src/builtins/value/hash.rs → boa/src/value/hash.rs

4
boa/src/builtins/value/mod.rs → boa/src/value/mod.rs

@ -5,8 +5,8 @@
#[cfg(test)]
mod tests;
use super::number::{f64_to_int32, f64_to_uint32};
use crate::builtins::{
number::{f64_to_int32, f64_to_uint32},
object::{GcObject, Object, ObjectData, PROTOTYPE},
property::{Attribute, Property, PropertyKey},
BigInt, Number,
@ -641,7 +641,7 @@ impl Value {
/// # Examples
///
/// ```
/// use boa::builtins::value::Value;
/// use boa::Value;
///
/// let value = Value::number(3);
///

5
boa/src/builtins/value/operations.rs → boa/src/value/operations.rs

@ -1,8 +1,5 @@
use super::*;
use crate::builtins::{
number::{f64_to_int32, f64_to_uint32, Number},
value::PreferredType,
};
use crate::builtins::number::{f64_to_int32, f64_to_uint32, Number};
impl Value {
#[inline]

0
boa/src/builtins/value/rcbigint.rs → boa/src/value/rcbigint.rs

0
boa/src/builtins/value/rcstring.rs → boa/src/value/rcstring.rs

0
boa/src/builtins/value/rcsymbol.rs → boa/src/value/rcsymbol.rs

0
boa/src/builtins/value/tests.rs → boa/src/value/tests.rs

0
boa/src/builtins/value/type.rs → boa/src/value/type.rs

Loading…
Cancel
Save