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

Unified Diff: sdk/lib/_internal/compiler/implementation/helpers/expensive_set.dart

Issue 288103003: Change Set.toSet to always return a set with the same behavior. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change .clone() to use .toSet(). Update docs. 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
Index: sdk/lib/_internal/compiler/implementation/helpers/expensive_set.dart
diff --git a/sdk/lib/_internal/compiler/implementation/helpers/expensive_set.dart b/sdk/lib/_internal/compiler/implementation/helpers/expensive_set.dart
index 61bad617677d4270d29ba06762a4553c8260fb18..55741afdf08974c974dcc9f4cb9b672887d37ae9 100644
--- a/sdk/lib/_internal/compiler/implementation/helpers/expensive_set.dart
+++ b/sdk/lib/_internal/compiler/implementation/helpers/expensive_set.dart
@@ -120,5 +120,17 @@ class ExpensiveSet<E> extends IterableBase<E> implements Set<E> {
retainWhere(retainSet.contains);
}
+ Set<E> toSet() {
+ var result = new ExpensiveSet<E>(_sets.length);
+ for (int i = 0; i < _sets.length; i++) {
+ result._sets[i] = _sets[i].toSet();
+ }
+ return result;
+ }
+
+ Set<E> cloneEmpty() {
+ return new ExpensiveSet<E>(_sets.length)
+ }
+
String toString() => "expensive(${_sets[0]}x${_sets.length})";
}

Powered by Google App Engine
This is Rietveld 408576698