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

Throw RangeError when BigInt division by zero occurs #790

Merged
merged 7 commits into from
Oct 4, 2020

Conversation

JohnDoneth
Copy link
Contributor

This Pull Request closes #780.

It changes the following:
Adds a check when dividing by zero to throw a RangeError if y (the right-hand expression) is 0n.
Spec: https://www.ecma-international.org/ecma-262/#sec-numeric-types-bigint-divide

@codecov
Copy link

codecov bot commented Oct 4, 2020

Codecov Report

Merging #790 into master will decrease coverage by 0.15%.
The diff coverage is 40.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #790      +/-   ##
==========================================
- Coverage   59.28%   59.13%   -0.16%     
==========================================
  Files         156      155       -1     
  Lines        9820     9842      +22     
==========================================
- Hits         5822     5820       -2     
- Misses       3998     4022      +24     
Impacted Files Coverage Δ
boa/src/context.rs 70.13% <0.00%> (+6.74%) ⬆️
boa/src/syntax/ast/node/operator/bin_op/mod.rs 69.44% <ø> (ø)
boa/src/value/operations.rs 44.67% <50.00%> (+0.07%) ⬆️
boa/src/builtins/function/mod.rs 60.21% <0.00%> (-19.57%) ⬇️
boa/src/builtins/math/mod.rs 51.87% <0.00%> (-13.89%) ⬇️
boa/src/builtins/error/type.rs 65.00% <0.00%> (-12.28%) ⬇️
boa/src/builtins/error/range.rs 65.00% <0.00%> (-12.28%) ⬇️
boa/src/builtins/error/reference.rs 65.00% <0.00%> (-12.28%) ⬇️
boa/src/builtins/console/mod.rs 19.10% <0.00%> (-10.28%) ⬇️
boa/src/builtins/bigint/mod.rs 63.33% <0.00%> (-6.67%) ⬇️
... and 35 more

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 3e60d2c...f464ce4. Read the comment docs.

@HalidOdat HalidOdat added bug Something isn't working execution Issues or PRs related to code execution labels Oct 4, 2020
@HalidOdat HalidOdat added this to the v0.11.0 milestone Oct 4, 2020
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.

Looks good to me!

@HalidOdat HalidOdat merged commit ff358d1 into boa-dev:master Oct 4, 2020
@JohnDoneth JohnDoneth deleted the division_by_zero_fix branch October 4, 2020 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working execution Issues or PRs related to code execution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

panic on division by zero
4 participants