Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(550)

Unified Diff: pkg/yaml/lib/src/utils.dart

Issue 297753003: Ensure that YAML maps' map keys are order-independent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/yaml/CHANGELOG.md ('k') | pkg/yaml/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/yaml/lib/src/utils.dart
diff --git a/pkg/yaml/lib/src/utils.dart b/pkg/yaml/lib/src/utils.dart
index 64cad472704830ed7c5ac74e3ce58c1375a7b035..e485e6aeff546446e14edde6907be254dfebbb1e 100644
--- a/pkg/yaml/lib/src/utils.dart
+++ b/pkg/yaml/lib/src/utils.dart
@@ -20,7 +20,9 @@ int hashCodeFor(obj) {
parents.add(value);
try {
if (value is Map) {
- return _hashCodeFor(value.keys) ^ _hashCodeFor(value.values);
+ var equality = const SetEquality();
Jennifer Messerly 2014/05/20 22:51:25 maybe use UnorderedIterableEquality and avoid the
nweiz 2014/05/20 22:58:54 Oh, I missed that, good idea.
+ return equality.hash(value.keys.map(_hashCodeFor).toSet()) ^
+ equality.hash(value.values.map(_hashCodeFor).toSet());
} else if (value is Iterable) {
return const IterableEquality().hash(value.map(hashCodeFor));
}
« no previous file with comments | « pkg/yaml/CHANGELOG.md ('k') | pkg/yaml/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698