Skip to content

Throw RangeError when BigInt division by zero occurs#790

Merged
HalidOdat merged 7 commits into
boa-dev:masterfrom
JohnDoneth:division_by_zero_fix
Oct 4, 2020
Merged

Throw RangeError when BigInt division by zero occurs#790
HalidOdat merged 7 commits into
boa-dev:masterfrom
JohnDoneth:division_by_zero_fix

Conversation

@JohnDoneth
Copy link
Copy Markdown
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

Comment thread boa/src/syntax/ast/node/operator/bin_op/mod.rs Outdated
@codecov
Copy link
Copy Markdown

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.

Comment thread boa/src/syntax/ast/node/operator/bin_op/mod.rs Outdated
@HalidOdat HalidOdat added A-Bug Something isn't working A-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
@JohnDoneth JohnDoneth requested a review from HalidOdat October 4, 2020 18:34
Copy link
Copy Markdown
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

A-Bug Something isn't working A-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