@@ -76,6 +76,9 @@ namespace Sass {
7676 }
7777 return true ;
7878 }
79+ if (auto m = Cast<Map>(&rhs)) {
80+ return m->empty () && empty ();
81+ }
7982 return false ;
8083 }
8184
@@ -458,18 +461,44 @@ namespace Sass {
458461 }
459462 // ensure both have same units
460463 l.normalize (); r.normalize ();
461- Units & lhs_unit = l, &rhs_unit = r;
464+ Units& lhs_unit = l, & rhs_unit = r;
462465 if (!(lhs_unit == rhs_unit)) {
463466 /* ToDo: do we always get usefull backtraces? */
464467 throw Exception::IncompatibleUnits (*this , rhs);
465468 }
466469 if (lhs_unit == rhs_unit) {
467470 return l.value () < r.value ();
468- } else {
471+ }
472+ else {
469473 return lhs_unit < rhs_unit;
470474 }
471475 }
472476
477+ bool Number::operator > (const Number& rhs) const
478+ {
479+ // unitless or only having one unit are equivalent (3.4)
480+ // therefore we need to reduce the units beforehand
481+ Number l (*this ), r (rhs); l.reduce (); r.reduce ();
482+ size_t lhs_units = l.numerators .size () + l.denominators .size ();
483+ size_t rhs_units = r.numerators .size () + r.denominators .size ();
484+ if (!lhs_units || !rhs_units) {
485+ return l.value () > r.value ();
486+ }
487+ // ensure both have same units
488+ l.normalize (); r.normalize ();
489+ Units& lhs_unit = l, & rhs_unit = r;
490+ if (!(lhs_unit == rhs_unit)) {
491+ /* ToDo: do we always get usefull backtraces? */
492+ throw Exception::IncompatibleUnits (*this , rhs);
493+ }
494+ if (lhs_unit == rhs_unit) {
495+ return l.value () > r.value ();
496+ }
497+ else {
498+ return lhs_unit > rhs_unit;
499+ }
500+ }
501+
473502 // ///////////////////////////////////////////////////////////////////////
474503 // ///////////////////////////////////////////////////////////////////////
475504
0 commit comments