Allow mod 0 (#255)

Closes #254
This commit is contained in:
Natalie Weizenbaum 2018-03-16 13:39:21 -07:00 committed by GitHub
parent 486b31b27f
commit 9d3c8cdc1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -11,6 +11,8 @@
* Add an `--indented` command-line option for using the indented syntax with a
stylesheet from standard input.
* Don't crash on `$x % 0`.
### Dart API
* Add a `Logger` class that allows users to control how messages are printed by

View File

@ -317,7 +317,8 @@ class SassNumber extends Value implements ext.SassNumber {
Value modulo(Value other) {
if (other is SassNumber) {
return _coerceNumber(other, (num1, num2) {
if (num2 >= 0) return num1 % num2;
if (num2 > 0) return num1 % num2;
if (num2 == 0) return double.NAN;
// Dart has different mod-negative semantics than Ruby, and thus than
// Sass.