Skip to content

Commit

Permalink
Merge pull request #2331 from mgreter/bugfix/nr-cmp-map-key
Browse files Browse the repository at this point in the history
Fix number compare issues when used as map keys
  • Loading branch information
mgreter authored Feb 16, 2017
2 parents bce8c39 + 6a3f953 commit 0763336
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ast_fwd_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@ namespace Sass {
struct CompareNodes {
template <class T>
bool operator() (const T& lhs, const T& rhs) const {
// code around sass logic issue. 1px == 1 is true
// but both items are still different keys in maps
if (dynamic_cast<Number*>(lhs.ptr()))
if (dynamic_cast<Number*>(rhs.ptr()))
return lhs->hash() == rhs->hash();
return !lhs.isNull() && !rhs.isNull() && *lhs == *rhs;
}
};
Expand Down

0 comments on commit 0763336

Please sign in to comment.