Skip to content
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

Add a boa_interop crate #3772

Merged
merged 6 commits into from
Apr 2, 2024
Merged

Add a boa_interop crate #3772

merged 6 commits into from
Apr 2, 2024

Conversation

hansl
Copy link
Contributor

@hansl hansl commented Mar 28, 2024

This crate will contain types and functions to help integrating boa in Rust projects, making it easier to interop between the host and the JavaScript code.

See #3770

This crate will contain types and functions to help integrating
boa in Rust projects, making it easier to interop between the
host and the JavaScript code.

See boa-dev#3770
Copy link

codecov bot commented Mar 28, 2024

Codecov Report

Attention: Patch coverage is 73.52941% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 49.71%. Comparing base (6ddc2b4) to head (88b3d27).
Report is 113 commits behind head on main.

Files Patch % Lines
core/interop/src/loaders/hashmap.rs 47.05% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3772      +/-   ##
==========================================
+ Coverage   47.24%   49.71%   +2.46%     
==========================================
  Files         476      456      -20     
  Lines       46892    44781    -2111     
==========================================
+ Hits        22154    22261     +107     
+ Misses      24738    22520    -2218     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jedel1043 jedel1043 requested a review from a team March 28, 2024 22:23
Copy link
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on this! Thanks for presenting it and taking it on!

Below is some initial feedback after a quick overview.

core/interop/src/lib.rs Show resolved Hide resolved
impl HashMapModuleLoader {
/// Creates an empty `HashMapModuleLoader`.
#[must_use]
pub fn new() -> Self {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion/issue: not sure that new is needed here if all it does is call Default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some people don't like to import default (it's not part of std prelude). I've seen this pattern in places, including the rust std: https://github.com/rust-lang/rust/blob/master/library/std/src/collections/hash/map.rs#L229-L234

I'm okay replacing it with empty() too if you want.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say to just leave it. The std uses the same pattern of having a new method that does the same as default, so I think we should do the same.

@nekevss nekevss requested a review from a team March 28, 2024 23:15
core/interop/src/lib.rs Outdated Show resolved Hide resolved
@hansl hansl requested review from jedel1043 and nekevss March 29, 2024 19:01
Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

core/gc/src/trace.rs Outdated Show resolved Hide resolved
impl HashMapModuleLoader {
/// Creates an empty `HashMapModuleLoader`.
#[must_use]
pub fn new() -> Self {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say to just leave it. The std uses the same pattern of having a new method that does the same as default, so I think we should do the same.

@hansl hansl requested a review from jedel1043 April 2, 2024 17:53
Copy link
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on this!

Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Looks good to me! :)

@raskad raskad added this pull request to the merge queue Apr 2, 2024
Merged via the queue into boa-dev:main with commit 37db6a4 Apr 2, 2024
14 checks passed
@hansl hansl deleted the boa_interop branch April 2, 2024 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants