From a12ce8200e7209834941ae4163b1e1eda49e3188 Mon Sep 17 00:00:00 2001 From: Halid Odat Date: Mon, 7 Sep 2020 10:27:25 +0200 Subject: [PATCH] Move `property` module to root (#684) --- boa/examples/classes.rs | 2 +- boa/src/builtins/array/mod.rs | 6 ++---- boa/src/builtins/function/mod.rs | 2 +- boa/src/builtins/json/mod.rs | 6 ++---- boa/src/builtins/map/mod.rs | 6 ++---- boa/src/builtins/mod.rs | 1 - boa/src/builtins/object/internal_methods.rs | 6 ++---- boa/src/builtins/object/mod.rs | 2 +- boa/src/builtins/regexp/mod.rs | 3 ++- boa/src/builtins/string/mod.rs | 2 +- boa/src/builtins/symbol/mod.rs | 2 +- boa/src/class.rs | 4 ++-- boa/src/environment/global_environment_record.rs | 2 +- boa/src/environment/object_environment_record.rs | 2 +- boa/src/exec/mod.rs | 2 +- boa/src/lib.rs | 1 + boa/src/{builtins => }/property/attribute/mod.rs | 0 boa/src/{builtins => }/property/attribute/tests.rs | 0 boa/src/{builtins => }/property/mod.rs | 3 ++- boa/src/value/mod.rs | 12 +++++++----- 20 files changed, 30 insertions(+), 34 deletions(-) rename boa/src/{builtins => }/property/attribute/mod.rs (100%) rename boa/src/{builtins => }/property/attribute/tests.rs (100%) rename boa/src/{builtins => }/property/mod.rs (99%) diff --git a/boa/examples/classes.rs b/boa/examples/classes.rs index 3d39be0d84..52c38d6e45 100644 --- a/boa/examples/classes.rs +++ b/boa/examples/classes.rs @@ -1,8 +1,8 @@ use boa::{ - builtins::property::Attribute, class::{Class, ClassBuilder}, exec::Interpreter, forward_val, + property::Attribute, realm::Realm, Finalize, Result, Trace, Value, }; diff --git a/boa/src/builtins/array/mod.rs b/boa/src/builtins/array/mod.rs index 1de0c8d9ac..c54aad546e 100644 --- a/boa/src/builtins/array/mod.rs +++ b/boa/src/builtins/array/mod.rs @@ -14,11 +14,9 @@ mod tests; use super::function::{make_builtin_fn, make_constructor_fn}; use crate::{ - builtins::{ - object::{ObjectData, PROTOTYPE}, - property::{Attribute, Property}, - }, + builtins::object::{ObjectData, PROTOTYPE}, exec::Interpreter, + property::{Attribute, Property}, value::{same_value_zero, Value}, BoaProfiler, Result, }; diff --git a/boa/src/builtins/function/mod.rs b/boa/src/builtins/function/mod.rs index 8232c8c256..ba722e7119 100644 --- a/boa/src/builtins/function/mod.rs +++ b/boa/src/builtins/function/mod.rs @@ -14,11 +14,11 @@ use crate::{ builtins::{ object::{Object, ObjectData, PROTOTYPE}, - property::{Attribute, Property}, Array, }, environment::lexical_environment::Environment, exec::Interpreter, + property::{Attribute, Property}, syntax::ast::node::{statement_list::RcStatementList, FormalParameter}, BoaProfiler, Result, Value, }; diff --git a/boa/src/builtins/json/mod.rs b/boa/src/builtins/json/mod.rs index d4691f6da4..508d1e8bee 100644 --- a/boa/src/builtins/json/mod.rs +++ b/boa/src/builtins/json/mod.rs @@ -14,11 +14,9 @@ //! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON use crate::{ - builtins::{ - function::make_builtin_fn, - property::{Property, PropertyKey}, - }, + builtins::function::make_builtin_fn, exec::Interpreter, + property::{Property, PropertyKey}, BoaProfiler, Result, Value, }; use serde_json::{self, Value as JSONValue}; diff --git a/boa/src/builtins/map/mod.rs b/boa/src/builtins/map/mod.rs index 74a38b6d48..75f160dd9b 100644 --- a/boa/src/builtins/map/mod.rs +++ b/boa/src/builtins/map/mod.rs @@ -2,11 +2,9 @@ use super::function::{make_builtin_fn, make_constructor_fn}; use crate::{ - builtins::{ - object::{ObjectData, PROTOTYPE}, - property::{Attribute, Property}, - }, + builtins::object::{ObjectData, PROTOTYPE}, exec::Interpreter, + property::{Attribute, Property}, BoaProfiler, Result, Value, }; use ordered_map::OrderedMap; diff --git a/boa/src/builtins/mod.rs b/boa/src/builtins/mod.rs index c0211b318b..1d373393fc 100644 --- a/boa/src/builtins/mod.rs +++ b/boa/src/builtins/mod.rs @@ -15,7 +15,6 @@ pub mod math; pub mod nan; pub mod number; pub mod object; -pub mod property; pub mod regexp; pub mod string; pub mod symbol; diff --git a/boa/src/builtins/object/internal_methods.rs b/boa/src/builtins/object/internal_methods.rs index b4f7e57821..8a1e52977b 100644 --- a/boa/src/builtins/object/internal_methods.rs +++ b/boa/src/builtins/object/internal_methods.rs @@ -6,10 +6,8 @@ //! [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots use crate::{ - builtins::{ - object::Object, - property::{Attribute, Property, PropertyKey}, - }, + builtins::object::Object, + property::{Attribute, Property, PropertyKey}, value::{same_value, Value}, BoaProfiler, }; diff --git a/boa/src/builtins/object/mod.rs b/boa/src/builtins/object/mod.rs index 116d1f29a6..eeb31a986c 100644 --- a/boa/src/builtins/object/mod.rs +++ b/boa/src/builtins/object/mod.rs @@ -17,10 +17,10 @@ use crate::{ builtins::{ function::{make_builtin_fn, make_constructor_fn, Function}, map::ordered_map::OrderedMap, - property::{Property, PropertyKey}, BigInt, Date, RegExp, }, exec::Interpreter, + property::{Property, PropertyKey}, value::{same_value, RcBigInt, RcString, RcSymbol, Value}, BoaProfiler, Result, }; diff --git a/boa/src/builtins/regexp/mod.rs b/boa/src/builtins/regexp/mod.rs index 3ebf101a25..8e60291626 100644 --- a/boa/src/builtins/regexp/mod.rs +++ b/boa/src/builtins/regexp/mod.rs @@ -13,8 +13,9 @@ use regex::Regex; use super::function::{make_builtin_fn, make_constructor_fn}; use crate::{ - builtins::{object::ObjectData, property::Property}, + builtins::object::ObjectData, exec::Interpreter, + property::Property, value::{RcString, Value}, BoaProfiler, Result, }; diff --git a/boa/src/builtins/string/mod.rs b/boa/src/builtins/string/mod.rs index b6503d34a3..446062b7ca 100644 --- a/boa/src/builtins/string/mod.rs +++ b/boa/src/builtins/string/mod.rs @@ -16,10 +16,10 @@ use super::function::{make_builtin_fn, make_constructor_fn}; use crate::{ builtins::{ object::{Object, ObjectData}, - property::Property, RegExp, }, exec::Interpreter, + property::Property, value::{RcString, Value}, BoaProfiler, Result, }; diff --git a/boa/src/builtins/symbol/mod.rs b/boa/src/builtins/symbol/mod.rs index 2ac1c7d702..6140bb078b 100644 --- a/boa/src/builtins/symbol/mod.rs +++ b/boa/src/builtins/symbol/mod.rs @@ -20,8 +20,8 @@ mod tests; use super::function::{make_builtin_fn, make_constructor_fn}; use crate::{ - builtins::property::{Attribute, Property}, exec::Interpreter, + property::{Attribute, Property}, value::{RcString, RcSymbol, Value}, BoaProfiler, Result, }; diff --git a/boa/src/class.rs b/boa/src/class.rs index 95dc82d3f6..4640bfb4c6 100644 --- a/boa/src/class.rs +++ b/boa/src/class.rs @@ -3,7 +3,7 @@ //! Native classes are implemented through the [`Class`][class-trait] trait. //! ``` //!# use boa::{ -//!# builtins::property::Attribute, +//!# property::Attribute, //!# class::{Class, ClassBuilder}, //!# exec::Interpreter, //!# forward_val, @@ -66,8 +66,8 @@ use crate::{ builtins::{ function::{BuiltInFunction, Function, FunctionFlags, NativeFunction}, object::{GcObject, NativeObject, Object, ObjectData, PROTOTYPE}, - property::{Attribute, Property, PropertyKey}, }, + property::{Attribute, Property, PropertyKey}, Interpreter, Result, Value, }; use std::fmt::Debug; diff --git a/boa/src/environment/global_environment_record.rs b/boa/src/environment/global_environment_record.rs index 62b9a5ac05..d0be6cadb6 100644 --- a/boa/src/environment/global_environment_record.rs +++ b/boa/src/environment/global_environment_record.rs @@ -8,13 +8,13 @@ //! More info: use crate::{ - builtins::property::{Attribute, Property}, environment::{ declarative_environment_record::DeclarativeEnvironmentRecord, environment_record_trait::EnvironmentRecordTrait, lexical_environment::{Environment, EnvironmentType}, object_environment_record::ObjectEnvironmentRecord, }, + property::{Attribute, Property}, Value, }; use gc::{Finalize, Trace}; diff --git a/boa/src/environment/object_environment_record.rs b/boa/src/environment/object_environment_record.rs index 1ffc32038f..0741a39f9c 100644 --- a/boa/src/environment/object_environment_record.rs +++ b/boa/src/environment/object_environment_record.rs @@ -7,11 +7,11 @@ //! More info: [Object Records](https://tc39.es/ecma262/#sec-object-environment-records) use crate::{ - builtins::property::{Attribute, Property}, environment::{ environment_record_trait::EnvironmentRecordTrait, lexical_environment::{Environment, EnvironmentType}, }, + property::{Attribute, Property}, Value, }; use gc::{Finalize, Trace}; diff --git a/boa/src/exec/mod.rs b/boa/src/exec/mod.rs index e627403e80..105c1ce183 100644 --- a/boa/src/exec/mod.rs +++ b/boa/src/exec/mod.rs @@ -27,10 +27,10 @@ use crate::{ builtins::{ function::{Function, FunctionFlags, NativeFunction}, object::{GcObject, Object, ObjectData, PROTOTYPE}, - property::{Property, PropertyKey}, Console, Symbol, }, class::{Class, ClassBuilder}, + property::{Property, PropertyKey}, realm::Realm, syntax::ast::{ constant::Const, diff --git a/boa/src/lib.rs b/boa/src/lib.rs index 910895879e..4ef322fa9b 100644 --- a/boa/src/lib.rs +++ b/boa/src/lib.rs @@ -39,6 +39,7 @@ pub mod class; pub mod environment; pub mod exec; pub mod profiler; +pub mod property; pub mod realm; pub mod syntax; pub mod value; diff --git a/boa/src/builtins/property/attribute/mod.rs b/boa/src/property/attribute/mod.rs similarity index 100% rename from boa/src/builtins/property/attribute/mod.rs rename to boa/src/property/attribute/mod.rs diff --git a/boa/src/builtins/property/attribute/tests.rs b/boa/src/property/attribute/tests.rs similarity index 100% rename from boa/src/builtins/property/attribute/tests.rs rename to boa/src/property/attribute/tests.rs diff --git a/boa/src/builtins/property/mod.rs b/boa/src/property/mod.rs similarity index 99% rename from boa/src/builtins/property/mod.rs rename to boa/src/property/mod.rs index 9ce6fc5571..17e36ad307 100644 --- a/boa/src/builtins/property/mod.rs +++ b/boa/src/property/mod.rs @@ -19,7 +19,8 @@ use gc::{Finalize, Trace}; use std::convert::TryFrom; use std::fmt; -pub mod attribute; +mod attribute; + pub use attribute::Attribute; /// This represents a Javascript Property AKA The Property Descriptor. diff --git a/boa/src/value/mod.rs b/boa/src/value/mod.rs index 760fe2260e..3f451c6b2f 100644 --- a/boa/src/value/mod.rs +++ b/boa/src/value/mod.rs @@ -5,13 +5,15 @@ #[cfg(test)] mod tests; -use crate::builtins::{ - number::{f64_to_int32, f64_to_uint32}, - object::{GcObject, Object, ObjectData, PROTOTYPE}, +use crate::exec::Interpreter; +use crate::{ + builtins::{ + number::{f64_to_int32, f64_to_uint32}, + object::{GcObject, Object, ObjectData, PROTOTYPE}, + BigInt, Number, + }, property::{Attribute, Property, PropertyKey}, - BigInt, Number, }; -use crate::exec::Interpreter; use crate::{BoaProfiler, Result}; use gc::{Finalize, GcCellRef, GcCellRefMut, Trace}; use serde_json::{map::Map, Number as JSONNumber, Value as JSONValue};