Chromium Code Reviews| Index: tests/compiler/dart2js/serialization/test_helper.dart |
| diff --git a/tests/compiler/dart2js/serialization/test_helper.dart b/tests/compiler/dart2js/serialization/test_helper.dart |
| index d753b53a4c0f09d246eb52a733cee0b44eb31e4c..885cdb90773515df059b4d5b74b2a92482299962 100644 |
| --- a/tests/compiler/dart2js/serialization/test_helper.dart |
| +++ b/tests/compiler/dart2js/serialization/test_helper.dart |
| @@ -163,7 +163,8 @@ Set computeSetDifference( |
| Iterable set2, |
| List common, |
| List unfound, |
| - [bool sameElement(a, b) = equality]) { |
| + {bool sameElement(a, b): equality, |
| + void onSameElement(a, b)}) { |
|
Siggi Cherem (dart-lang)
2016/05/11 23:55:24
consistent with the comments from other CLs, maybe
Johnni Winther
2016/05/12 10:47:44
Done.
|
| // TODO(johnniwinther): Avoid the quadratic cost here. Some ideas: |
| // - convert each set to a list and sort it first, then compare by walking |
| // both lists in parallel |
| @@ -175,6 +176,9 @@ Set computeSetDifference( |
| bool found = false; |
| for (var element2 in remaining) { |
| if (sameElement(element1, element2)) { |
| + if (onSameElement != null) { |
| + onSameElement(element1, element2); |
| + } |
| found = true; |
| remaining.remove(element2); |
| break; |
| @@ -199,11 +203,13 @@ bool checkSetEquivalence( |
| String property, |
| Iterable set1, |
| Iterable set2, |
| - bool sameElement(a, b)) { |
| + bool sameElement(a, b), |
| + {void onSameElement(a, b)}) { |
| List common = []; |
| List unfound = []; |
| Set remaining = |
| - computeSetDifference(set1, set2, common, unfound, sameElement); |
| + computeSetDifference(set1, set2, common, unfound, |
| + sameElement: sameElement, onSameElement: onSameElement); |
| if (unfound.isNotEmpty || remaining.isNotEmpty) { |
| String message = |
| "Set mismatch for `$property` on $object1 vs $object2: \n" |