-
-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Merged by Bors] - Safe wrapper for JsSet
#2162
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2162 +/- ##
==========================================
- Coverage 42.32% 42.14% -0.19%
==========================================
Files 228 230 +2
Lines 21047 21232 +185
==========================================
+ Hits 8909 8949 +40
- Misses 12138 12283 +145
Continue to review full report at Codecov.
|
Ok, with #2115 we now have a simple API to handle JS iterators. Maybe it would be good if you checked out the PR and the corresponding implementation of |
boa_engine/src/builtins/set/mod.rs
Outdated
@@ -164,7 +164,8 @@ impl Set { | |||
Ok(set.into()) | |||
} | |||
|
|||
/// Utility for constructing `Set` Objects. | |||
/// Utility for constructing `Set` objects. | |||
#[allow(clippy::unnecessary_wraps)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for allowing this lint?
I think it would be better to return only a JsObject
as the lint recommends
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because JsArray
does it too (internal_methods::ordinary_define_own_property), I did the same to maintain some sort of consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good to maintain consistency when it doesn't affect the usability of our program. However, this change impacts the usability, because now you need to handle an error on a function that cannot error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some leftover debug prints, but looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. Thanks for the additional typo fixes :)
bors r+ |
This PR adds a safe wrapper around JavaScript `JsSet` from `builtins::set`, and is being tracked at #2098. Implements following methods - [x] `Set.prototype.size` - [x] `Set.prototype.add(value)` - [x] `Set.prototype.clear()` - [x] `Set.prototype.delete(value)` - [x] `Set.prototype.has(value)` - [x] `Set.prototype.forEach(callbackFn[, thisArg])` Implement wrapper for `builtins::set_iterator`, to be used by following. - [x] `Set.prototype.values()` - [x] `Set.prototype.keys()` - [x] `Set.prototype.entries()` *Note: Are there any other functions that should be added? Also adds `set_create()` and made `get_size()` public in `builtins::set`.
Pull request successfully merged into main. Build succeeded: |
JsSet
JsSet
This PR adds a safe wrapper around JavaScript
JsSet
frombuiltins::set
, and is being tracked at #2098.Implements following methods
Set.prototype.size
Set.prototype.add(value)
Set.prototype.clear()
Set.prototype.delete(value)
Set.prototype.has(value)
Set.prototype.forEach(callbackFn[, thisArg])
Implement wrapper for
builtins::set_iterator
, to be used by following.Set.prototype.values()
Set.prototype.keys()
Set.prototype.entries()
*Note: Are there any other functions that should be added?
Also adds
set_create()
and madeget_size()
public inbuiltins::set
.