From 255f4e4ce47bb214c8a092af5789e68fcbee8be9 Mon Sep 17 00:00:00 2001 From: "ager@google.com" Date: Thu, 14 Mar 2013 07:47:37 +0000 Subject: [PATCH] "Reverting 19985" R=lrn@google.com BUG= Review URL: https://codereview.chromium.org//12413023 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19986 260f80e4-7a28-3924-810f-c04153c831b5 --- sdk/lib/collection/collections.dart | 8 +++++--- sdk/lib/collection/hash_set.dart | 15 ++++----------- sdk/lib/collection/linked_hash_set.dart | 15 ++++----------- sdk/lib/core/set.dart | 8 ++------ sdk/lib/html/dartium/html_dartium.dart | 3 --- tests/co19/co19-compiler.status | 2 ++ tests/co19/co19-dart2js.status | 11 +++++++---- tests/co19/co19-runtime.status | 14 +++++++++----- 8 files changed, 33 insertions(+), 43 deletions(-) diff --git a/sdk/lib/collection/collections.dart b/sdk/lib/collection/collections.dart index 5d8431743f5..4cf7daf326a 100644 --- a/sdk/lib/collection/collections.dart +++ b/sdk/lib/collection/collections.dart @@ -382,13 +382,15 @@ class IterableMixinWorkaround { return new ListMapView(l); } - static bool setContainsAll(Set set, Iterable other) { - for (var element in other) { - if (!set.contains(element)) return false; + static bool isSubsetOfSet(Set set, Set other) { + if (set.length > other.length) return false; + for (var element in set) { + if (!other.contains(element)) return false; } return true; } + static Set setIntersection(Set set, Set other, Set result) { Set smaller; Set larger; diff --git a/sdk/lib/collection/hash_set.dart b/sdk/lib/collection/hash_set.dart index ca32220cf7d..48331100aec 100644 --- a/sdk/lib/collection/hash_set.dart +++ b/sdk/lib/collection/hash_set.dart @@ -86,19 +86,12 @@ class HashSet extends Collection implements Set { } // Set. - bool isSubsetOf(Collection other) { - // Deprecated, and using old signature. - Set otherSet; - if (other is Set) { - otherSet = other; - } else { - otherSet = other.toSet(); - } - return IterableMixinWorkaround.setContainsAll(otherSet, this); + bool isSubsetOf(Set other) { + return IterableMixinWorkaround.isSubsetOfSet(this, other); } - bool containsAll(Iterable other) { - return IterableMixinWorkaround.setContainsAll(this, other); + bool containsAll(Set other) { + return IterableMixinWorkaround.isSubsetOfSet(other, this); } Set intersection(Set other) { diff --git a/sdk/lib/collection/linked_hash_set.dart b/sdk/lib/collection/linked_hash_set.dart index 8a4d566130c..829e801459b 100644 --- a/sdk/lib/collection/linked_hash_set.dart +++ b/sdk/lib/collection/linked_hash_set.dart @@ -128,19 +128,12 @@ class LinkedHashSet extends Collection implements Set { } // Set. - bool isSubsetOf(Collection other) { - // Deprecated, and using old signature. - Set otherSet; - if (other is Set) { - otherSet = other; - } else { - otherSet = other.toSet(); - } - return IterableMixinWorkaround.setContainsAll(otherSet, this); + bool isSubsetOf(Set other) { + return IterableMixinWorkaround.isSubsetOfSet(this, other); } - bool containsAll(Iterable other) { - return IterableMixinWorkaround.setContainsAll(this, other); + bool containsAll(Set other) { + return IterableMixinWorkaround.isSubsetOfSet(other, this); } Set intersection(Set other) { diff --git a/sdk/lib/core/set.dart b/sdk/lib/core/set.dart index 8856d41e36d..bad4c79f2c7 100644 --- a/sdk/lib/core/set.dart +++ b/sdk/lib/core/set.dart @@ -36,17 +36,13 @@ abstract class Set extends Collection { /** * Returns true if [other] contains all the elements of this Set. - * - * *Deprecated*. Use `other.containsAll(thisSet)` instead if [other] - * is a Set, and convert `other` to a Set if it isn't. */ - @deprecated - bool isSubsetOf(Iterable other); + bool isSubsetOf(Set other); /** * Returns true if this Set contains all the elements of [other]. */ - bool containsAll(Iterable other); + bool containsAll(Set other); /** * Returns a new set which is the intersection between this set and [other]. diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart index ce24c289d26..571032b69d7 100644 --- a/sdk/lib/html/dartium/html_dartium.dart +++ b/sdk/lib/html/dartium/html_dartium.dart @@ -35264,7 +35264,6 @@ class _Utils { static window() native "Utils_window"; static print(String message) native "Utils_print"; - static forwardingPrint(String message) native "Utils_forwardingPrint"; static SendPort spawnDomFunctionImpl(Function topLevelFunction) native "Utils_spawnDomFunction"; static int _getNewIsolateId() native "Utils_getNewIsolateId"; static bool shadowRootSupported(Document document) native "Utils_shadowRootSupported"; @@ -35344,5 +35343,3 @@ get _printClosure => (s) { _Utils.print(s); } }; - -final _forwardingPrintClosure = _Utils.forwardingPrint; diff --git a/tests/co19/co19-compiler.status b/tests/co19/co19-compiler.status index 339d647d603..c7ca410176d 100644 --- a/tests/co19/co19-compiler.status +++ b/tests/co19/co19-compiler.status @@ -114,6 +114,8 @@ LibTest/core/Set/every_A01_t03: Fail # issue 390 LibTest/core/Set/forEach_A01_t05: Fail # issue 390 LibTest/core/Set/intersection_A01_t01: Fail # issue 390 LibTest/core/Set/intersection_A01_t02: Pass # issue 390 +LibTest/core/Set/isSubsetOf_A01_t01: Fail # issue 390 +LibTest/core/Set/isSubsetOf_A01_t02: Fail # issue 390 LibTest/core/Set/removeAll_A01_t01: Fail # issue 390 LibTest/core/Set/remove_A01_t01: Fail # issue 390 LibTest/core/Set/remove_A01_t03: Fail # issue 390 diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status index d5b4e7e3a6e..a1810a11e62 100644 --- a/tests/co19/co19-dart2js.status +++ b/tests/co19/co19-dart2js.status @@ -651,21 +651,22 @@ LibTest/isolate/SendPort/call_A01_t01: Fail # Future is in async library. co19 i LibTest/core/Set/add_A01_t06: Fail # issue 390 LibTest/core/Set/containsAll_A01_t01: Fail # issue 390 +LibTest/core/Set/containsAll_A01_t02: Pass # issue 390 LibTest/core/Set/every_A01_t01: Fail # issue 390 LibTest/core/Set/every_A01_t03: Fail # issue 390 LibTest/core/Set/forEach_A01_t05: Fail # issue 390 LibTest/core/Set/intersection_A01_t01: Fail # issue 390 LibTest/core/Set/intersection_A01_t02: Fail # issue 390 LibTest/core/Set/intersection_A01_t03: Fail # issue 390 +LibTest/core/Set/intersection_A03_t01: Pass # issue 390 +LibTest/core/Set/isSubsetOf_A01_t01: Fail # issue 390 +LibTest/core/Set/isSubsetOf_A01_t02: Pass # issue 390 LibTest/core/Set/removeAll_A01_t01: Fail # issue 390 LibTest/core/Set/remove_A01_t01: Fail # issue 390 LibTest/core/Set/remove_A01_t03: Fail # issue 390 # Issues with co19 test suite in unchecked mode. [ $compiler == dart2js && $unchecked ] -LibTest/core/Set/containsAll_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). Passes in checked mode due to Issue 390. -LibTest/core/Set/intersection_A03_t01: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). Passes in checked mode due to Issue 390. - LibTest/core/Future/chain_A02_t05: Fail # Future is in async library. co19 issue 367 LibTest/core/Future/transform_A02_t04: Fail # Future is in async library. co19 issue 367 @@ -868,9 +869,11 @@ LibTest/core/Map/remove_A01_t02: Fail # Doesn't expect null to be allowed in Set LibTest/core/Set/add_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). LibTest/core/Set/addAll_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). LibTest/core/Set/contains_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). +LibTest/core/Set/containsAll_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). +LibTest/core/Set/intersection_A03_t01: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). +LibTest/core/Set/isSubsetOf_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). LibTest/core/Set/remove_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). LibTest/core/Set/removeAll_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). -LibTest/core/Set/isSubsetOf_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). LibTest/core/Map/forEach_A01_t07: Fail # Doesn't expect concurrent modification error (issue 376). diff --git a/tests/co19/co19-runtime.status b/tests/co19/co19-runtime.status index b56ee19a45a..5f1b0b2b12b 100644 --- a/tests/co19/co19-runtime.status +++ b/tests/co19/co19-runtime.status @@ -525,9 +525,13 @@ LibTest/core/Map/remove_A01_t02: Fail # Doesn't expect null to be allowed in Set LibTest/core/Set/add_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). LibTest/core/Set/addAll_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). LibTest/core/Set/contains_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). +LibTest/core/Set/containsAll_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). +LibTest/core/Set/intersection_A03_t01: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). +LibTest/core/Set/isSubsetOf_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). LibTest/core/Set/remove_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). LibTest/core/Set/removeAll_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). -LibTest/core/Set/isSubsetOf_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). + +LibTest/core/Map/forEach_A01_t07: Fail # Doesn't expect concurrent modification error (issue 376). LibTest/core/String/charCodes_A01_t01: Fail # Deprecated string members removed (issue 382). LibTest/core/String/charCodeAt_A02_t01: Fail # Deprecated string members removed (issue 382). @@ -606,20 +610,20 @@ Language/14_Types/4_Interface_Types_A08_t06: Fail # Moved collection classes fro LibTest/core/Set/add_A01_t06: Fail # issue 390 LibTest/core/Set/containsAll_A01_t01: Fail # issue 390 +LibTest/core/Set/containsAll_A01_t02: Pass # issue 390 LibTest/core/Set/every_A01_t01: Fail # issue 390 LibTest/core/Set/every_A01_t03: Fail # issue 390 LibTest/core/Set/forEach_A01_t05: Fail # issue 390 LibTest/core/Set/intersection_A01_t01: Fail # issue 390 LibTest/core/Set/intersection_A01_t02: Fail # issue 390 LibTest/core/Set/intersection_A01_t03: Fail # issue 390 +LibTest/core/Set/intersection_A03_t01: Pass # issue 390 +LibTest/core/Set/isSubsetOf_A01_t01: Fail # issue 390 +LibTest/core/Set/isSubsetOf_A01_t02: Pass # issue 390 LibTest/core/Set/removeAll_A01_t01: Fail # issue 390 LibTest/core/Set/remove_A01_t01: Fail # issue 390 LibTest/core/Set/remove_A01_t03: Fail # issue 390 -[ $compiler == none && $runtime == vm && $unchecked ] -LibTest/core/Set/containsAll_A01_t02: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). Succeedes in checked mode due to Issue 390. -LibTest/core/Set/intersection_A03_t01: Fail # Doesn't expect null to be allowed in Set or Map keys (issue 377). Succeedes in checked mode due to Issue 390. - [ $compiler == none && $arch == simarm ] *: Skip