Ensure that YAML maps' map keys are order-independent. R=jmesserly@google.com BUG= Review URL: https://codereview.chromium.org//297753003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/yaml@36399 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkgs/yaml/CHANGELOG.md b/pkgs/yaml/CHANGELOG.md index 695e069..7d1fafd 100644 --- a/pkgs/yaml/CHANGELOG.md +++ b/pkgs/yaml/CHANGELOG.md
@@ -1,3 +1,7 @@ +## 0.9.0+2 + +* Ensure that maps are order-independent when used as map keys. + ## 0.9.0+1 * The `YamlMap` class is deprecated. In a future version, maps returned by
diff --git a/pkgs/yaml/lib/src/utils.dart b/pkgs/yaml/lib/src/utils.dart index 64cad47..463af70 100644 --- a/pkgs/yaml/lib/src/utils.dart +++ b/pkgs/yaml/lib/src/utils.dart
@@ -20,7 +20,9 @@ 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)); }
diff --git a/pkgs/yaml/pubspec.yaml b/pkgs/yaml/pubspec.yaml index c3eacd7..7186de0 100644 --- a/pkgs/yaml/pubspec.yaml +++ b/pkgs/yaml/pubspec.yaml
@@ -1,5 +1,5 @@ name: yaml -version: 0.9.0+1 +version: 0.9.0+2 author: "Dart Team <misc@dartlang.org>" homepage: http://www.dartlang.org description: A parser for YAML.