Skip to content

Commit

Permalink
Fix number compare issues when used as map keys
Browse files Browse the repository at this point in the history
  • Loading branch information
mgreter committed Feb 15, 2017
1 parent d5b6fe7 commit 1afbf4d
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 (Number* lhs_nr = dynamic_cast<Number*>(lhs.ptr()))
if (Number* rhs_nr = dynamic_cast<Number*>(rhs.ptr()))
return lhs_nr->hash() == rhs_nr->hash();
return !lhs.isNull() && !rhs.isNull() && *lhs == *rhs;
}
};
Expand Down

0 comments on commit 1afbf4d

Please sign in to comment.