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

Fix some panics in String.prototype properties #888

Merged
merged 2 commits into from
Oct 18, 2020
Merged

Fix some panics in String.prototype properties #888

merged 2 commits into from
Oct 18, 2020

Conversation

georgeroman
Copy link
Contributor

These changes address the failed to get argument for String method panics documented in #817.

@codecov
Copy link

codecov bot commented Oct 18, 2020

Codecov Report

Merging #888 into master will increase coverage by 0.48%.
The diff coverage is 22.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #888      +/-   ##
==========================================
+ Coverage   59.30%   59.79%   +0.48%     
==========================================
  Files         165      165              
  Lines       10383    10410      +27     
==========================================
+ Hits         6158     6225      +67     
+ Misses       4225     4185      -40     
Impacted Files Coverage Δ
boa/src/builtins/string/mod.rs 62.08% <22.22%> (+7.94%) ⬆️
boa/src/syntax/ast/node/operator/bin_op/mod.rs 71.29% <0.00%> (+0.92%) ⬆️
boa/src/value/operations.rs 48.25% <0.00%> (+0.95%) ⬆️
boa/src/value/conversions.rs 62.29% <0.00%> (+3.27%) ⬆️
boa/src/builtins/bigint/mod.rs 70.14% <0.00%> (+3.48%) ⬆️
boa/src/builtins/bigint/operations.rs 85.71% <0.00%> (+30.87%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 09d1889...3499db8. Read the comment docs.

@HalidOdat HalidOdat added bug Something isn't working builtins PRs and Issues related to builtins/intrinsics labels Oct 18, 2020
@HalidOdat HalidOdat added this to the v0.11.0 milestone Oct 18, 2020
Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

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

Looks good to me, but check my comment to see if we can improve performance a little bit.

let end = args
.get(1)
.expect("failed to get argument in slice")
.unwrap_or(&Value::integer(length))
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't this be more performant if it used unwrap_or_else()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, done

@Razican Razican merged commit f22a1c6 into boa-dev:master Oct 18, 2020
@georgeroman georgeroman deleted the fix-some-string-panics branch October 19, 2020 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working builtins PRs and Issues related to builtins/intrinsics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants