Skip to content

Commit

Permalink
Feat: Implement Set builtin object
Browse files Browse the repository at this point in the history
Includes change to Value::hash so that 1i32 == 1f64

closes #400, blocked by #1109
  • Loading branch information
RageKnify committed Feb 16, 2021
1 parent 13cc560 commit 8685942
Show file tree
Hide file tree
Showing 9 changed files with 946 additions and 1 deletion.
8 changes: 8 additions & 0 deletions boa/src/builtins/iterable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::{
builtins::ArrayIterator,
builtins::ForInIterator,
builtins::MapIterator,
builtins::SetIterator,
object::{GcObject, ObjectInitializer},
property::{Attribute, DataDescriptor},
BoaProfiler, Context, Result, Value,
Expand All @@ -12,6 +13,7 @@ use crate::{
pub struct IteratorPrototypes {
iterator_prototype: GcObject,
array_iterator: GcObject,
set_iterator: GcObject,
string_iterator: GcObject,
map_iterator: GcObject,
for_in_iterator: GcObject,
Expand All @@ -25,6 +27,7 @@ impl IteratorPrototypes {
context,
iterator_prototype.clone().into(),
),
set_iterator: SetIterator::create_prototype(context, iterator_prototype.clone().into()),
string_iterator: StringIterator::create_prototype(
context,
iterator_prototype.clone().into(),
Expand All @@ -48,6 +51,11 @@ impl IteratorPrototypes {
self.iterator_prototype.clone()
}

#[inline]
pub fn set_iterator(&self) -> GcObject {
self.set_iterator.clone()
}

#[inline]
pub fn string_iterator(&self) -> GcObject {
self.string_iterator.clone()
Expand Down
4 changes: 4 additions & 0 deletions boa/src/builtins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub mod nan;
pub mod number;
pub mod object;
pub mod regexp;
pub mod set;
pub mod string;
pub mod symbol;
pub mod undefined;
Expand All @@ -40,6 +41,8 @@ pub(crate) use self::{
object::for_in_iterator::ForInIterator,
object::Object as BuiltInObjectObject,
regexp::RegExp,
set::set_iterator::SetIterator,
set::Set,
string::String,
symbol::Symbol,
undefined::Undefined,
Expand Down Expand Up @@ -76,6 +79,7 @@ pub fn init(context: &mut Context) {
Date::init,
Map::init,
Number::init,
Set::init,
String::init,
RegExp::init,
Symbol::init,
Expand Down
Loading

0 comments on commit 8685942

Please sign in to comment.