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

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: code review 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..463af70133f992c7839a9ddfac29675ac25ba37b 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 UnorderedIterableEquality();
+ return equality.hash(value.keys.map(_hashCodeFor)) ^
+ equality.hash(value.values.map(_hashCodeFor));
} 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