OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library protocol; | 5 library protocol; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 | 9 |
10 part 'generated_protocol.dart'; | 10 part 'generated_protocol.dart'; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } | 122 } |
123 } | 123 } |
124 return true; | 124 return true; |
125 } | 125 } |
126 | 126 |
127 /** | 127 /** |
128 * Compare the maps [mapA] and [mapB], using [valueEqual] to compare map | 128 * Compare the maps [mapA] and [mapB], using [valueEqual] to compare map |
129 * values. | 129 * values. |
130 */ | 130 */ |
131 bool _mapEqual(Map mapA, Map mapB, bool valueEqual(a, b)) { | 131 bool _mapEqual(Map mapA, Map mapB, bool valueEqual(a, b)) { |
| 132 if (mapA == null) { |
| 133 return mapB == null; |
| 134 } |
| 135 if (mapB == null) { |
| 136 return false; |
| 137 } |
132 if (mapA.length != mapB.length) { | 138 if (mapA.length != mapB.length) { |
133 return false; | 139 return false; |
134 } | 140 } |
135 for (var key in mapA.keys) { | 141 for (var key in mapA.keys) { |
136 if (!mapB.containsKey(key)) { | 142 if (!mapB.containsKey(key)) { |
137 return false; | 143 return false; |
138 } | 144 } |
139 if (!valueEqual(mapA[key], mapB[key])) { | 145 if (!valueEqual(mapA[key], mapB[key])) { |
140 return false; | 146 return false; |
141 } | 147 } |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); | 852 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); |
847 hash = hash ^ (hash >> 11); | 853 hash = hash ^ (hash >> 11); |
848 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); | 854 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); |
849 } | 855 } |
850 | 856 |
851 static int hash2(a, b) => finish(combine(combine(0, a), b)); | 857 static int hash2(a, b) => finish(combine(combine(0, a), b)); |
852 | 858 |
853 static int hash4(a, b, c, d) => | 859 static int hash4(a, b, c, d) => |
854 finish(combine(combine(combine(combine(0, a), b), c), d)); | 860 finish(combine(combine(combine(combine(0, a), b), c), d)); |
855 } | 861 } |
OLD | NEW |